The Large Hadron Collider at CERN allows us to study heavy-ion collisions at an un- precedented energy. ALICE, A Large Ion Collider Experiment, is the experiment ded- icated to the investigation of heavy-ion collisions. In this contribution, recent open heavy-flavour results from pp collisions at [Formula: see text]= 5.02, 7, 8 and 13 TeV and p–Pb collisions at [Formula: see text] = 5.02 TeV, collected with the ALICE detector during the LHC Run-1 and Run-2 are presented. The results include the production cross section, nuclear modification factor and multiplicity dependence studies of production of D mesons and electrons from heavy-flavour hadron decays at mid-rapidity and of muons from heavy-flavour hadron decays at forward rapidity. Charm production was measured down to [Formula: see text] = 0 GeV/[Formula: see text] in pp and p–Pb collisions. Recent measurements of the production cross section of heavy charmed baryons such as [Formula: see text] (in pp and p–Pb) and [Formula: see text] (in pp) are discussed. The results are compared with theoretical model predictions.