The middle of the night is not the best time to walk into your bathroom and find out your toilet has flooded. Getting your feet wet is not pleasant, but even more unpleasant is the fact that you now have to deal with the problem and figure out what is going on with your toilet. If water is actively running out of your toilet, the first thing that you want to do is to make sure that you turn off the water to the toilet. The valve is usually right by the toilet. That will keep more water from pouring out. If your toilet flooded because it got clogged, there are other things you need to do about the problem.
Grab a Plunger
The first thing you want to do is to grab a plunger. There are different kinds of plungers. For your toilet, you want to have one with a flange on the bottom. The flange looks like a little cup on the end of the plunger. These plungers are usually black and made out of heavy rubber. The reason that they have a flange is that it goes into the drain of the toilet and fits snugly, while the rest of the plunger creates a seal around that drain. That keeps the air down into the pipe and headed toward the clog so that it can be dislodged. If the flange on your plunger has folded into the plunger, you will need to pull it out. Putting on a pair of work or latex gloves will let you do that without getting your hands yucky. Fit the plunger in the toilet, push it up and down a couple of times, pull it out, and see if the water starts to go down. If not, try it again.
Hot Water and Dish Soap
If it's in the middle of the night, you might not be able to rush right out and get another product to try to unclog your toilet, but you probably have dish soap, body soap, or shampoo. What you want to do is to boil up some water, pour some soap down into the toilet, let it settle, and then pour some hot water in the toilet. The slipperiness of the soap will help the clog to break up and to move.
If you are still having issues, then consider finding an emergency plumber to come out as soon as possible.