Logo

MonoCalc

/

Text Line Numberer

Text
Paste or type the text you want to number.
0 lines0 chars0 BNo line breaks

Quick presets

Mode

Walks the text line by line and attaches a counter to every line that qualifies, using the start value, step, format, and separator you choose.

The number given to the first numbered line.
Step between consecutive numbers — 10 gives a BASIC-style listing.
Sits between the number and the line. \t and \n are interpreted.

Quick separators

Number format

Auto padding width

Minimum digits; wider numbers are never truncated.
Whether the number is prepended or appended.
Decides whether an empty line consumes a number.
Writing LF for this text.

Trim whitespace on each line

Preserve indentation

Lines that do not match are copied through unnumbered.
For example ^TODO to number only the outstanding items.

Apply to a line range only

Turn on the restart switch below to use this.

Restart numbering periodically

Nothing to number yet

Paste text above, drop a .txt, .md, .csv or .log file onto the box, or load the sample and try a preset.

About This Tool

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.

Blank lines change what the numbers mean
Numbering a blank line makes the label match the physical row, which is what a code listing needs. Skipping it keeps the paragraph break but lets the counter advance only on real content, which is what a numbered list of items needs. Removing blank lines does both at once. Pick deliberately — this single choice decides whether your third paragraph is labelled 3 or 5.

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.

Frequently Asked Questions

Is the Text Line Numberer free?

Yes, Text Line Numberer is totally free :)

Can I use the Text Line Numberer offline?

Yes, you can install the webapp as PWA.

Is it safe to use Text Line Numberer?

Yes, any data related to Text Line Numberer only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

How does the Text Line Numberer work?

Your text is split on every line terminator — CRLF, LF, or a bare CR — and each line is walked in order. A line that qualifies receives the current counter value, rendered in the format you picked and joined to the line with your separator, after which the counter advances by the increment. Lines that are blank, outside the selected range, or excluded by the filter are copied through untouched so the counter never gets out of step.

Why should I zero-pad the line numbers?

Without padding, line 9 and line 10 start the text at different columns and the whole listing looks ragged. Zero-padding renders every number at the same width — 001, 010, 120 — so the content lines up in a straight column. Auto width sizes the padding to the largest number in your document, which is normally what you want; space-padding does the same job without printing the leading zeros.

Can it remove line numbers instead of adding them?

Yes. Remove mode strips an existing numbering label from each line, auto-detecting digits, Roman numerals, or letters followed by a separator such as a dot, bracket, colon, dash, or pipe. Auto-detect is deliberately cautious: it only strips when most non-blank lines look numbered and the numbers it finds actually climb, so a paragraph that happens to begin with a year is left alone.

Does numbering and then un-numbering give back my original text?

For the common formats, yes — the two passes are written against the same separator and label vocabulary, so a round trip returns the text unchanged. The exceptions are deliberate: leading whitespace is always preserved rather than guessed at, and a line that consists of nothing but a number is never stripped, because that number is far more likely to be your content than a label.

What happens to blank lines?

You choose. Number them like any other line, keep them in place but let them pass without consuming a number so the count reflects real content only, or drop them entirely before numbering starts. The blank-line choice is what determines whether your third paragraph is labelled 3 or 5.

Is my text uploaded anywhere?

No. Every pass runs in your browser using JavaScript, and nothing is sent to a server — which matters because this tool is most often used on proprietary code, log excerpts, and unpublished documents. Share links carry only your option settings, never the text itself.