The IRC (Figure R307.1) requires at least 15 inches from the toilet centerline to any side wall or fixture, and at least 21 inches of clear space in front of the bowl. Those are legal minimums from the model code; local codes can differ, and comfort guidelines want more like 30 inches in front. Always check your local code.

Source: IRC Figure R307.1 (checked August 2026). These minimums also apply to bidets; a lavatory has its own 21-inch front clearance, covered in the full bathroom clearances guide.
The free bathroom planner runs this exact check live: drag the toilet and the code check flags a violation, while the comfort layer separately marks what will merely feel tight. If passing the check means moving the toilet, here is what that costs.
From the centerline of the toilet to the finished side wall or the nearest fixture, on both sides. A vanity counts as a fixture; so does a tub. That is why a 30-inch-wide alcove is the practical minimum for a toilet.
Because code is the legal floor, not a comfort standard. Twenty-one inches keeps the door of the inspection office open; thirty inches keeps your knees comfortable. The planner shows both layers separately, so you know whether a tight spot is illegal or just unpleasant.
The IRC is a model code: most states and municipalities adopt it, often with amendments. Your local code is the one that counts, which is why every check in the planner ends with exactly that advice.