Space Requirements
Many communities follow the International Residential Code, which requires a 15-inch clearance, measured from the center of the toilet to the wall or nearest fixture on each side, plus a 21-inch clearance in front of it. Moreover, there must be at least 80 inches of clearance from the floor to the ceiling in the space occupied by the toilet as well as in the 21-inch area in front of it. The minimum bathroom door size in many communities is 24 inches, and it's best to make the door swing out to avoid having to provide clearance for it inside the space.
Toilet Options
If you choose a conventional flat-against-the-wall toilet model, you should look for one with a 10-inch rough-in; this means that the hole for the waste pipe is 10 inches from the wall, which is the minimum. Choose a model with a round bowl -- not an elongated one -- to maximize available clearance. Depending on the configuration of the room, you may save more space by installing a corner-mount model; most of these have 12-inch rough-ins. Because their flushing mechanisms are behind the wall, wall-hung toilets save more space than floor-mounts, but they are typically more expensive.