A handrail should begin early enough for you to grip it before taking the first step and continue until you can stand securely on level ground. This provides support through the transition between the stairs and the floor, where balance can be lost. Where space allows, extending the handrail beyond the top and bottom of the stairs can help.
Finish the handrail with a rounded end or return it towards the wall to avoid a protruding end, and keep the handrail continuous where possible. In confined spaces, doors and walkways may limit its length. Check the building requirements that apply locally.
