Most likely it’s a hemorrhoid with clotted blood inside.
Hemorrhoids are lumps or masses of tissue in the anus, which contain enlarged blood vessels. Hemorrhoids may be inside the anal canal (“internal hemorrhoids”). Here they primarily cause bleeding that comes and goes, usually with bowel movements.
They may also lie just outside the anal canal (“external hemorrhoids”). What you describe is an external hemorrhoid. The only thing you may feel is a non-painful lump. But they can cause discomfort. Swelling and discomfort may come and go when the hemorrhoids become especially irritated.
Many people have both internal and external hemorrhoids.
Sometimes the blood vessels in small external hemorrhoids may clot for no reason. This causes the sudden disturbing appearance of a ½ to 1 inch firm lump at the anal opening. I suspect this is what you feel. Doctors call it a thrombosed external hemorrhoid.
A thrombosed external hemorrhoid may be quite painful. Thrombosed external hemorrhoids usually go away with time.
Less likely, the bump is an abscess. Just inside the anal canal opening there are tiny glands. They’re too small to be noticed. Nevertheless, these little glands can be the origin of an infection, which leads to an abscess (a small collection or pocket of pus).
No one knows why some people get abscesses, and others do not. When an abscess forms in an anal gland, the abscess slowly gets larger and works its way toward the outside skin surrounding the anal opening. When this happens, the person notices a painful swelling in the area.
Sometimes this abscess will eventually break open on its own, and drain out pus and blood. Other times, a doctor can lance the abscess under local anesthesia to drain out the infection.
It’s also unlikely that the bumps you describe are anal warts. The technical terms for these — condylomata acuminatum — are caused by the human papilloma virus, or HPV. This virus is usually transmitted from person to person by direct contact, usually sexual contact.
The warts are small. But sometimes many slightly irregular growths are around the anal opening. Sometimes the warts extend slightly up inside the anus, where they can be hard to see. The warts may also affect the genital area. They usually cause few symptoms other than bothersome, warty growths.