The present invention relates to a compound of Antrodia camphorata used to inhibit HBV, in particular to an extract, 4-hydroxy-2,3-dimethoxy-6-methyl-5(3,7,11-trimethyl-dodeca-2,6,10-trienyl)-cyclohex-2-enone which is isolated from Antrodia camphorata, and its use in inhibiting HBV effectively. The cyclohexenone compound according to the present invention showed cytotoxicity on HBV-secreting human hepatoma cell line HepG2 2.2.15, decreased synthesis of HBV particles, further inhibited synthesis of HbsAg and HbeAg effectively to achieve the goal of HBV inhibition.