How the Add Line Numbers Tool Works
AnyTool Add Line Numbers processes text entirely in the browser. It normalises line endings (CRLF and CR to LF), splits the text into lines, then builds a numbering plan: each line that should be numbered is assigned a value starting at your chosen start and advancing by the step. The plan decides the auto padding width from the digits of the largest number, then each line is rebuilt as prefix, optional bracket, padded number, suffix and separator, followed by the original text. The result recomputes live on every keystroke or option change.
- Line endings are normalised so numbering is consistent across platforms
- Auto width equals the digit count of the largest line number
- Numbers can start at any integer and advance by a custom step
- Reverse mode assigns the highest value first and counts down
- All computation is client-side JavaScript — no server round-trip
