Anal cancer forms when a genetic mutation turns normal, healthy cells into abnormal cells. Healthy cells grow and multiply at a set rate, eventually dying at a set time. Abnormal cells grow and multiply out of control, and they don't die. The accumulating abnormal cells form a mass (tumor). Cancer cells invade nearby tissues and can separate from an initial tumor to spread elsewhere in the body (metastasize).
Anal cancer is closely related to a sexually transmitted infection called human papillomavirus (HPV). Evidence of HPV is detected in the majority of anal cancers. HPV is thought to be the most common cause of anal cancers.