ALICE is designated to study the quark–gluon plasma (QGP), a state of matter where, due to high temperature and density, quarks and gluons are deconfined. One of the probes used to investigate this state of matter is quarkonium states, bound states of either a charm and anti-charm quark pair (charmonia) or a bottom and anti-bottom quark pair (bottomonia). The presence of the QGP is expected to modify the quarkonium production yields in a very specific way due to a balance between medium-induced suppression, and a recombination mechanism or a hadronization mechanism. To understand the the properties of the QGP in nucleus-nucleus collisions, it is essential to measure the quarkonium differential yields in proton–proton collisions, as it provides a reference and allows the investigation of quarkonium production mechanisms, as well as in proton–nucleus collisions to understand the cold nuclear matter effects that appear. In this contribution, the latest results for quarkonium production measured with the ALICE detector in pp collisions at different collision energies are reported. The measurements of the nuclear modification factor and anisotropic flow in Pb–Pb collisions at sNN=5.02TeV and in p–Pb at sNN=8.16TeV at mid- and forward rapidity are also reported. All measurements are compared to various theoretical predictions.