You might be getting a puppy and looking into what you need to housetrain them or you might already have a puppy or dogs and be getting frustrated as getting them housetrained is turning out to not be as easy as you thought.
I once had a dog that was taught in the rescue she lived in that a certain room was the toilet, which she went to happily, however it did mean that when I took her on I had to break those habits and teach her to toilet outside as she really had no idea where it was appropriate to toilet. Every dog presents different challenges but they all have a common instinct that will facilitate the housetraining behaviour, they do not like to toilet in their den!
You need to be setting your puppy up to succeed, it is our responsibility to teach them where their den is. Be patient, it will take time, it is not instinctive for the dog to go to the toilet outside and they need to learn this. They need to know our house is their den, they do not like to go to the toilet in their den, this is where a crate comes in. Gradually you will be teaching them by expanding their idea of their den area and teaching them where their toilet is. It will usually take several weeks to complete, but some breeds take longer. A regular feeding schedule will help with a regular toilet break.
Early on in their life, their mother will have cleaned up after them and they will have gradually imitated her, so if they were from a puppy farm where the mother had to wee near her bed, this is what they will have learned. The smell off the toilet acts like a trigger, so they will use the same place again.
The number one mistake with house training is too much space and freedom too early. Every puppy needs a short term confinement area or den, this should be a small area, such as a crate that they love being in. The crate should be just big enough for them to turn around, sit and lie down, any bigger and they will use the space to relieve themselves. The general rule for the time in their crate is one hour per month of their life and this matches how long they can hold their bladder, but no dog should ever be left for longer than 6 hours in a crate.
Make their den the best place to be. Put a blanket over it or put it under a table so it feels nice and safe like a den, put a nice comfy bed with lots of a variety of toys and a treat filled dispensers with good quality treats should be used to encourage them to go in the crate on their own. Do not just throw them in the crate as you are going out as they will fear that the crate means being left alone.
Once they are comfortable going in and out of the crate, start to close the door for a brief time and let them come straight out. Avoid picking them up and putting them in the crate, they should go in voluntarily. To help them enjoy being in the crate, start feeding them in the crate with the door open. As you lengthen the time they are in the crate, you need to practice leaving them and returning to the crate. As you leave, you should be quiet, no goodbyes or petting, just walk away, you are returning soon and this is what you are aiming for them to understand. When you return, let them out immediately or you will encourage them to whine and yap and get excited. Practice many times closing the door, walking away quietly well out of their sight and hearing, a few minutes later, return and open the door, again silently to stop the energy building up before they are let out, do not praise them as they come out as you do not wish to associate leaving the crate with rewards, only going in.
General rule for the time in their crate is one hour per month of their life, but they should never be left for longer than 6 hours in a crate. If you need to leave them longer, you also need to incorporate a long term confinement area, however no young puppy should ever be left longer than 4 hours alone, and this is only after the settling in period where you have built up to this from 15 minutes.
A long term confinement area could be a large puppy pen, a small room or bathroom and the crate should be left in there open with their bed and toys inside the crate to encourage them to still see the crate as their den, leave a radio as white noise to stop any external noises that may upset them and an unwashed item of your clothing so they can smell your scent while you are gone, possibly a sock.
There must be puppy pads over the entire surface of the long term confinement area as it is an area that they are allowed to relieve themselves. Gradually, over a period of weeks, reduce to one pad. If you puppy makes a mistake add a pad, never scold it for making a mistake. You must take them outside too to ensure they realise where they can toilet outside or you can end up with a dog who will only toilet on puppy pads.
There are two main times your puppy will go to the toilet, the first is when they wake and the second is about ten minutes after their feed. When you first get your dog you need to take them out every hour to let them relieve themselves. When they relieve themselves in their toilet area, let them finish and then praise them for going to the toilet in the right place. Take them outside just before you go to bed or put them in their long term confinement area if this is not possible.
If puppy is out with you, you need to supervise them 100% of the time; the only time you can take your eye of them is immediately after they have been to the toilet. Set an alarm clock to go off every hour and take them out to their toilet area. Immediately after they have been to the toilet, not during, give them an appropriate and motivating reward, their favourite treat, praise is not enough of a reward to work quickly. Repetition and consistency are the key. The more times you reward them for using their toilet area, the quicker they will understand why you are rewarding them. When you are supervising them, as you see them squat, pick them up and take them to their toilet area. If they start to go to the toilet, clap your hands, not to scare them but to make them stop so you can take them outside. Expect some accidents to happen. If they do go to the toilet where they should not, ensure you clean it thoroughly and get specialist cleaning fluids from your local pet shop to ensure they do not smell it and return to that spot to relieve themself again.
Remember, it is up to you to teach your dog where your den is. Going to the toilet outside is not natural, it is taught. Always use positive reinforcement when they have used their toilet space. Never use negative reinforcement as the only thing this will teach is that they should be scared of you.