Text Line Numberer – Number Every Line of Any Text
The moment two people need to talk about the same document, they need a way to point at a specific part of it. "The bug is on line 47" is precise; "somewhere in the middle of the parser" is not. A text line numberer takes a block of pasted or typed text — a code snippet, a log excerpt, a transcript, a contract, a flat list of items — and attaches a sequential label to every line, so the whole thing becomes referenceable. It also runs the operation backwards, stripping the numbering that a code viewer or a PDF added when you copied text out of it.
Start number, increment, and why they exist
The default of starting at 1 and stepping by 1 covers most work, but both values are yours to set. Starting at 240 continues the numbering of a document that already ran to 239, which is how a long file gets numbered in sections without the count resetting. Stepping by 10 reproduces the classic BASIC program listing — 10 PRINT, 20 GOTO 10 — where the gaps existed so new statements could be inserted between existing ones without renumbering everything. A negative increment counts down, which is occasionally what a countdown list or a reverse-chronological log wants.
Padding is what makes a listing readable
Numbering a file of more than nine lines with plain digits pushes the text one column to the right at line 10 and again at line 100, and the result reads as ragged. Zero-padding renders every label at a common width — 001, 010, 120 — so the content starts at the same column on every row. Space-padding achieves the same alignment while keeping the numbers visually quiet. Setting the width to auto sizes it to the largest number the document will actually reach, and padding never truncates: a number wider than the requested width is printed in full rather than clipped.
Formats beyond 1, 2, 3
Not every document counts in Arabic digits. Legal clauses and outlines conventionally use Roman numerals (i), ii), iii)), and exam papers and sub-clauses use letters (a., b., c.). Lettering uses bijective base-26, the same scheme as spreadsheet columns, so it continues past z into aa, ab, and beyond rather than running out. Roman numerals are defined here up to 3999; past that the label falls back to digits instead of printing something invented.
Numbering only part of the text
A line range restricts numbering to lines N through M and copies everything else through untouched — the way you number one section of a long file. A filter goes further and numbers only the lines that contain a given string or match a regular expression, so a pattern of ^TODO turns a mixed notes file into a numbered action list while the prose around it stays as it was. Restart every N lines resets the counter periodically, which is how paginated output keeps each page starting at 1.
Stripping numbering back off
Text copied out of a code viewer, a PDF, or an answer on a forum usually arrives with the gutter attached, and the numbers have to go before the code will run. Remove mode detects digits, Roman numerals, or letters followed by a dot, bracket, colon, dash, or pipe, and takes them away. Detection is intentionally conservative: it strips only when most non-blank lines look numbered and the numbers found actually climb, so a paragraph beginning 2024 was a busy year keeps its year. A custom regular expression is available for numbering the auto-detector was never going to recognise. Every pass runs entirely in your browser — proprietary code and unpublished documents never leave your machine — and the result copies to the clipboard, downloads as .txt or as a line_number,content CSV, or feeds straight back in for another pass.