Take these important steps if you have this issue at home.
How to Stop Your Cat From Peeing on the Carpet

Why Your Cats Might be Peeing on the Carpet
Just like humans, cats are complex creatures. Cats urinate on floors, clothing, beds, walls or other surfaces for many reasons. It could be something environmental like a new pet in the home, or physical like an illness.
“Cats have numerous ways to leave messages for each other, and one way is through urine marking,” according to the American Society for the Prevention of Cruelty to Animals (ASPCA).
“By urine marking, a cat tells other cats of his presence and makes a statement about such things as what piece of property is his, how long ago he was in the area and, over time, when other cats can expect him to return.”

Keep Cats Separated
If you have multiple cats, the easiest first step to stop indoor urination is to keep them in separate areas of the house. It might also help identify which cat is peeing on the carpet.
Depending on the size and layout of your home, keeping them apart might be easier said than done. A pet gate can help. If the urine issues stop, you can try to reintroduce them to the same living areas.

Thoroughly Clean the Area
This probably seems obvious, but a deep, thorough cleaning is crucial to stopping the cat(s) from urinating in the wrong place over and over and over again.
It can be tough to get cat pee out of carpet, but it’s essential to preventing future accidents. If not properly cleaned, urine can leave permanent stains or smells on surfaces. Cats have strong olfactory senses, so they might view any lingering smell as an invitation to pee again in the same spot. One of the other cats also might come and pee there as well.

Address the Litter Box(es)
If your cat is an indoor and outdoor pet, adding a litter box could help. If you cat is strictly indoors and already uses a litter box, there are other alternative ideas you can try to stop your cat from peeing outside the litter box. Cleaning it more often might fix the issue.
If those ideas don’t work, switch the litter brand to something with less fragrance. You can also purchase a new type of litter box that’s larger or smaller, add more litter boxes, or move your current one to a different room in the house.

Talk to Your Vet
If the urination issues continue, or you notice any other unusual behaviors by your cat, it’s probably time to take it to the veterinarian. Waiting too long to fix a treatable issue can do long-term damage, so do not hesitate to take your cat in if you have concerns.
“The sudden appearance of litter box issues could indicate anything from a urinary tract infection to bladder stones or kidney disease,” according to Hillcrest Animal Hospital.