First off, you must choose the appropriate litter box. This is essential to train your cat to use a litter box. The ideal litter is clumping and not scented. If your cat is from a previous owner, continue using the litter the previous owner used. It is good to experiment and see which litter the cat prefers. Make sure the box is easily accessible for the cat. It should not be difficult for the cat to climb into the box.
Placing the litter box in the appropriate place is also important. Cats will not eliminate close to where they eat or sleep, so make sure the cat's litter box is kept at a distance from those areas. Ideally, there should be one litter box per cat if you have more than one cat as this helps to train your cat to use the litter box for them. The litter box should be placed in a room away from disturbance or distraction. If the cat has found a favored hiding place such as a closet or back room, put the litter box in that area. Cats will eliminate where they are comfortable, so try to keep a comfortable environment for your cat.
The most important part of training your cat to use a litter box is getting the cat to eliminate in the box. Creating a routine is a good way to get your cat to use the litter box regularly. A cycle of playing, activity, eating, and sleeping is best. After the cat has engaged in activity, take it to the litter box. When the cat wakes up after a nap, do the same. Setting up regular eating habits will create a regular eliminating cycle. If the cat does not eliminate in the box, do not scold it. Scolding will make the cat afraid of you. Instead, praise the cat every time it eliminates in the litter box. Make sure to clean the box regularly. Your cat will not want to use a dirty litter box.
Once you have trained your cat to use the litter box, it may still eliminate in other areas. Cats are territorial. They will spray on furniture or other areas to mark their territory, which is normal. There are other reasons for eliminating outside of the litter box. Your cat may be experiencing a change, such as new people in the house or rearrangement of the room it is accustomed. It may have also found a new area it is comfortable in. In some cases, the problem may be serious, like urinary tract disease or diabetes. Take your cat to the vet to be sure.