The invention relates to the field of polypeptide medicament, and particularly relates to an anti-hepatitis B virus X protein peptide and polypeptide coding the peptide, and application thereof. Specifically, the invention relates to a polypeptide with functional activity to inhibit hepatitis B virus X protein (HBx) at the molecular level, cellular level and animal level, and therefore can inhibit hepatitis caused by hepatitis B virus infection of, cirrhosis caused by repeated attack of hepatitis, and the liver cancer occurred on the basis of cirrhosis. The polypeptide and peptide analogs thereof including their functional fragments and functional variants, and the genes encoding these peptides, peptide analogs or their functional fragments and functional variants can be widely used for the prevention and control of hepatopathy after hepatitis B infection including hepatitis, cirrhosis and liver cancer.