Building codes can vary between countries (despite the international building code), and even between states. Before installing your own stair rail, always consult a local building inspector to find out what the code is for your area. However, variations in the code are often minimal, and so if you can follow a basic set of requirements, you'll be well on your way to passing your next inspection with a safe, quality stair rail.
According to the New York State Residential Code: "Handrails shall be provided on at least one side of each stairway with two or more risers. Handrail height, measured above stair tread nosings, shall be not less than 34 inches and not more than 38 inches."
You'll find that 36 inches is a standard and comfortable height for a stair handrail.
The NYSRC goes on to state: "All required handrails shall be continuous the full length of the stairs from a point directly above the top riser of a flight to a point directly above the lowest riser of the flight. Ends shall be returned or shall terminate in newel posts or safety terminals."
This means that the length of the handrail must be free of obstructions such as decorative newel posts, and that the rail must end in either a return into a wall, or end at a newel post. Essentially, your must be be allowed to slide without interruption along the length of the rail from the top step to the bottom.
Space from Walls
The NYSRC finally demands that: "Handrails adjacent to a wall shall have a space of not less than 1-1/2 inches between the wall and the handrail."
This hand-sized space between the wall and the rail is necessary to provide graspability of the rail, as a firm grip on the rail is essential for safety.
The NYSRC allows for the following code exceptions: "1. Handrails shall be permitted to be interrupted by a newel post at a turn. 2. The use of a volute or starting easing shall be allowed over the lowest tread."
This means that if your stairs have a landing that transitions the stairway around an angle, the handrail's continuous graspability may be interrupted by a newel post at the point of the railing's turn. The second exception allows for a "volute" to terminate the rail over the last step. A volute is a scroll, curve, spiral or knob to signify the end of the rail.