Set spindles at a round number and the last gap ends up wrong for the life of the balustrade. This works the other way round: it finds the smallest count whose gap stays under your limit, then divides the run exactly.
Notes
Why you work backwards from the gap
The gap is what people see and what usually has a maximum. So you fix the maximum, find the smallest number of spindles that respects it, and let the actual gap land wherever it lands — evenly.
Gaps and safety limits
Balustrade gap limits vary by country and by where the balustrade is. Set the maximum yourself from whatever applies to your job — this tool does not know your local rules and does not pretend to.
Setting out on site
Mark centres, not gaps. Measuring gap to gap accumulates error and the last spindle ends up visibly off. Every centre in the table is measured from the same end.
What this does not do
It lays out a straight run between two posts. Curved runs, rake sections and transitions each need their own setting out.