Please take him to your Veterinarian for a checkup. There might be an underlying medical problem.
I have a male cat that sprayed in the house after we got a new kitten. I cleaned all the carpets with pet odor shampoo and used a steam cleaner on bare floors. When it was all dry, he went back to the litter box. I can only assume he was looking for the familiar smell of his previous accidents. When the smell was gone, the urge to remark was gone too. I had been cleaning the floor in the usual manner with a mop and cleaner. the steam cleaner seemed to clean more effectively.
I agree with Robyn Fed's advice. I have a cat rescue and the first thing we do when receiving a rescue is a trip to the vet for a complete physical and shots and neutering/spaying.
They also make some cat foods that are especially for cats who have a problem with pH balance issues which results in painful urination and UTI's. They will do as your cat is doing oftentimes when this is the problem.
And also, some male cats are "sprayers" and will never stop this. In that case they will have to become an outside cat, which will of course lower their chances of a long life by many years.
Good advice so far. They will mark territory when confused. I.E. flood earthquake scared in general. mine did ht after air conditioner backed up and hall and closet were soaked.
If he is not neutered, he may be "spraying". They do this to mark territory, especially if there is another male cat.
I would keep him in a room with a litter box with grass or hay on top of it. Could he have a bladder infection? A UTI or be diabetic, which makes a cat pee all the time and can cause a UTI. A vet check up would be in order. Is the litter box clean? Cats sometimes don't like the feel of a particular litter. Try a different litter, and as a last result, buy some catnip spray and spray some of it on the litterbox. He will have a good experience then of the litterbox.
Here are some further ideas, and I hope the cat gets to feeling better.
I'm not a cat person but if he were mine he would pee in the box or pee outside. Cat pee stinks up a house with odor that refuses to go away.
Add your voice to the conversation. Click here to answer this question.