Cantharidin (CAN), a potent inhibitor of serine/threonine-protein phosphatase 2A (PP2A), is widely used in clinical practice, particularly in the treatment of advanced cancer due to its specific action on these types of cancer. In the present study, the inhibitory effect of CAN was examined in two cholangiocarcinoma cell lines (QBC939 and Hucc-t1). Following treatment with CAN, cell viability was effectively reduced in QBC939 and Hucc-t1 cells and normal human intrahepatic biliary epithelial cells. However, a slight increase in reactive oxygen species levels in QBC939 cells treated with CAN was observed post-treatment. CAN significantly inhibited cell migration and invasion in a dose-dependent manner. Western blot analysis demonstrated that the nuclear factor-κB (NF-κB) pathway was stimulated by CAN, which was confirmed by the upregulated phosphorylation levels of inhibitor of NF-κB kinase subunit α (IKKα) and NF-κB inhibitor α (IκBα) in cells, and an increased NF-κB p65 subunit level in the nucleus. The expression levels of 72 kDa type IV collagenase (MMP2) and matrix metalloproteinase 9 (MMP9) were downregulated by CAN. Notably, there was a negative association between MMP2 and MMP9 expression levels, and NF-κB p65, although NF-κB p65 regulates the expression of MMP2 and MMP9 and has a positive association with these proteins in various types of cancer. Notably, it was observed that CAN exerted specific inhibition on PP2A activity and thereby resulted in the activation of the IKKα/IκBα/NF-κB pathway. Therefore, CAN-induced cell inhibition maybe partially dependent on the activation of the IKKα/IκBα/NF-κB pathway. In conclusion, it was demonstrated that CAN selectively and effectively inhibited cholangiocarcinoma cell migration and invasion. The present study may provide a novel insight into the use of CAN as a therapeutic candidate in the treatment of cholangiocarcinoma.