Skip to content

Line Number Adder: Number Lines of Text Online

Line number adder that numbers every line of text with your choice of start, step, separator, and zero padding. Can also strip old numbers.

By Updated Runs in your browser

Line Number Adder guide

Add line numbers to code snippets, transcripts, legal drafts, lyrics, and checklists. Pick where numbering starts, the separator, and padding, skip blank lines if you like, then copy the result.

Why number lines at all

Line numbers turn vague feedback into precise feedback. Compare the third paragraph reads oddly with line 14 reads oddly. Code reviewers, editors, lawyers, teachers, and transcriptionists all rely on the same trick: a shared reference that survives email, chat, and printouts.

Word processors and code editors show line numbers in the margin, but those numbers disappear the moment you copy the text into Slack, an email, a GitHub comment, or a support ticket. This tool writes the numbers into the text itself, so they travel with it.

How the numbering works

The text is split on line breaks, both Unix (LF) and Windows (CRLF). Each line gets a label made of the current number and your separator, then the counter advances by the step. With start 1, step 1, and a period separator, the first three lines become 1. , 2. , and 3. .

Padding makes every label the same width. The tool works out the largest number you will reach, counts its digits, and pads the others to match. With 120 lines and zero padding, line 7 becomes 007. With space padding it becomes two spaces and a 7, so the text after the numbers lines up in a monospace font.

If you tick Don't number blank lines, empty lines (including lines with only spaces) pass through unchanged and do not consume a number. The width calculation only counts the lines that will actually be numbered.

Worked example

Input, five lines with a blank line in the middle: Preheat the oven to 425°F. / Toss the vegetables with olive oil and salt. / (blank) / Roast for 25 minutes, flipping halfway. / Finish with lemon juice.

Default settings number all five lines 1 to 5, including the blank one, which becomes just 3. followed by nothing. Tick Don't number blank lines and the steps become 1 to 4 with the blank line preserved, which is usually what you want for recipes and instructions. Set start to 10 and step to 10 and you get 10, 20, 30, 40, leaving room to insert a step between any two later.

Choosing a format for the job

Code snippets: use space padding and a pipe or tab separator, like 9 | const x = 1;. It keeps the code aligned and makes it obvious which characters are part of the code. Legal and academic drafts: court filings and many style guides number every line, often in multiples of 1 or 5, so readers can cite a page and line. Transcripts and interviews: numbered lines let researchers quote exact passages, which is standard in qualitative research. Lists and checklists: a period or parenthesis separator reads naturally.

Zero padding helps when the output will be sorted as text. Plain numbers sort as 1, 10, 11, 2; padded numbers sort as 01, 02, 10, 11. That matters if you number file names, rows you will paste into a spreadsheet, or anything a computer will sort alphabetically.

Removing line numbers

The reverse problem is just as common: you copied code from a PDF, a book, or a blog that embeds line numbers, and now every line starts with 12. or 07 |. Tick Remove existing line numbers and the tool strips a leading number plus one separator from each line: a period, parenthesis, colon, pipe, dash, tab, or space.

One caution: it removes any number at the very start of a line. If your real content has lines that begin with a number, such as 2026 budget, it will strip those too, so check the output before using it.

Common mistakes

Numbering text that will be edited heavily afterward: every insert shifts every number below it, so add numbers last. Using a proportional font and expecting alignment: padding only lines up in monospace fonts. And pasting numbered code back into an editor without stripping the numbers, which breaks the code. Keep the unnumbered original.

Frequently asked questions

How do I add line numbers to text?

Paste your text into the box. Every line gets a number instantly, starting at 1 with a period and space (1. ). Change the start, step, separator, or padding and the output updates live.

Can I skip blank lines?

Yes. Tick Don't number blank lines and empty lines are kept for spacing but not counted, so the numbering stays continuous across paragraphs.

What does zero padding do?

It pads numbers to the same width with leading zeros, so 1 to 120 becomes 001 to 120. Padded numbers sort correctly as text and line up in monospace fonts. Align with spaces does the same with spaces instead.

How do I remove line numbers from copied code?

Tick Remove existing line numbers. It strips a leading number followed by a period, parenthesis, colon, pipe, dash, tab, or space from every line, which cleans up code copied from PDFs, books, and some websites.

Can I count by 5s or 10s?

Yes. Set Step to 5 or 10. Numbering by 10 (10, 20, 30) is the old BASIC convention and still handy when you expect to insert lines later.

How do I add line numbers in Word or Google Docs?

In Word, go to Layout > Line Numbers. Google Docs added line numbers under Tools > Line numbers in 2023. Both show numbers in the margin only; this tool puts them into the text itself so they survive copy and paste.

Is my text uploaded?

Everything runs in your browser. Nothing you enter is uploaded to a server or stored by us.

Does it handle Windows line endings?

Yes. Both LF and CRLF line breaks are recognized, and the output uses LF, which every modern editor, browser, and chat app handles correctly.

Is there a line limit?

No fixed limit. Tens of thousands of lines number instantly because everything runs in your browser.