Replacing the sub floor in the bathroom often is necessary if you've had a leaky fixture that caused the floor to rot. The job requires that you remove all the rotten boards and replace them with new sheeting. While sometimes you can simply remove the rotten sheets, most of the time it's easier if you take everything off and start from scratch, particularly if the boards show any sign of water damage. Before you begin any project like this, find out where the leak started and fix it immediately. You'll have to do the same job again if you don't.
Take up the flooring. Remove the existing floor covering and inspect the area. See if you have to replace all the sub floor or only a portion. If the area around the tub isn't rotten, leave it alone. You can salvage some of the flooring that shows no sign of rot. If you can insert a screwdriver into it easily or it's soggy, it's bad.
Remove the fixtures. To take out the toilet, you first need to shut off the water. Flush after you shut off the water to remove the water from the tank. Remove the water supply to the toilet and loosen the nuts at the bottom. Pull the toilet. Normally this is the area where many of the problems begin. If it's necessary, remove all the other fixtures. Map out the sub floor you'll replace. Note the locations of the openings for plumbing.
Pry up the old underlayment, which is the layer of board over the sub floor. When you tear up the underlayment, you might find that there are sections of the sub floor untouched by the mould or rot. Again, if they're large enough, you can salvage those areas. Use the pry bar method to remove both the underlayment and sub floor. If you cut out a section, first drill a hole to determine the depth, set the circular saw for that depth and cut the square. Finish it with a handsaw.
Check the joists to make sure that they're still sturdy. It doesn't hurt to scab a 2-by-6 onto the side of a joist so you have a secure area to patch. If the joists are rotten, you need to replace them. (Call a professional for this.)
Replace the plywood with wood of similar thickness. Make sure that you nail or screw the sub floor securely to the joists at many different points. Nailing is one option, but many carpenters and professional remodelers prefer to use screws for a secure connection. Before you lay the sub floor, take measurements for cutouts like the drainpipe for the toilet and water pipes. Use the diagram you made from the old sub floor. Stagger the seams for extra strength.
Put down the new underlayment. Some people use concrete backerboard, particularly if they lay tile on it. Particleboard has a tendency to swell, and it's best to replace it with plywood that's the same thickness.
Always wear a mask, particularly if there's mould on the sub floor. Use protective eye gear and gloves.