There are many reasons for painful swelling in the anus, and the common reasons are as follows: first, it may be a submucosal abscess of the rectum, sometimes the anal gland infection spreads along the rectum to the surrounding area, forming a submucosal abscess of the rectum, which generally manifests as painful swelling in the anus and rectum, sometimes with a cramping sensation. Secondly, if you have previous hemorrhoids, a large amount of stimulating food in the diet, such as chili peppers, after drinking a lot of alcohol will lead to the nucleus of hemorrhoids, swelling, hemorrhoidal vein congestion, which will lead to painful distention in the anus. Thirdly, if you have had anal fissures in the past, especially long-term chronic anal fissures, dry stools can sometimes stimulate the fissure wound, which can aggravate the anal fissures, there will be a feeling of swelling and pain in the anus, and the pain is sometimes spasmodic. Therefore, there are many reasons for anal distension and pain, which should be combined with medical history, rectal examination and, if necessary, anoscopy to clarify the diagnosis.