It’s often tempting to try to squeeze bathroom spaces when designing a house. A comfortably sized bathroom is worth the extra few inches though.
The IRC says the minimum width from the centerline of the toilet to the nearest cabinet or wall is 15″, making 30″ of wall space an absolute requirement for your toilet. It also mandates that you have 21″ clear in front of the toilet.
We generally find 36″ of wall space to create a much more pleasant bathroom space, and design our bathrooms to that criteria. We also provide at least 24″ clear in front of the toilet where possible.
In master bathrooms, a toilet room/water closet is frequently designed for privacy – generally pushing the walls out another few inches to 42″ will keep the space from being claustrophic, as well as allowing room for the door swing in and room to turn around.