Add Line Numbers to Text Online

A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call

Free tool to add line numbers to text: choose the starting number, step, separator and zero padding, and skip blank lines. Copy the numbered text instantly.

Numbered text
Lines numbered
0

Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.

How to add line numbers to text

  1. Paste your text into the box. Each line will get its own number.
  2. Choose where numbering starts (1 by default) and the step between numbers (1 gives 1, 2, 3; 10 gives 10, 20, 30).
  3. Choose a separator between the number and the text: "1. ", "1) ", "1: ", "1 - ", a tab or a space.
  4. Tick "Zero padding" to make all the numbers the same width (01, 02 … 10), which keeps text lined up and sorts correctly.
  5. Tick "Don't number blank lines" to skip empty lines, so the numbering only counts lines with content.
  6. Copy the numbered text. The tool also shows how many lines were numbered.

The tool works instantly in your browser. Your text isn't sent or stored anywhere.

Why add line numbers?

Line numbers make it easy to refer to a specific line. "See line 14" is far quicker than "the paragraph that starts with…". People add line numbers to:

  • Code snippets in emails, tickets, documentation and code reviews.
  • Scripts and screenplays for rehearsals and edits.
  • Poems and song lyrics for study and discussion.
  • Legal and transcription documents, where line references are standard.
  • Lists and checklists, turning plain lines into a numbered list.
  • Logs and data files, to reference specific entries.
  • Teaching materials, so students can point to the exact line they're asking about.
  • Proofreading and editing, when several people are commenting on a draft.

Options explained

Start at. Begin at any number. If you're numbering the second page of a document that ended at line 48, start at 49. You can also start at 0, as programmers sometimes do.

Step. Count by any amount. A step of 10 gives 10, 20, 30, which is how old BASIC programs were numbered so new lines could be inserted between them. A step of 5 is common for marking every fifth line in verse.

Separator. Choose how the number is joined to the text:

Separator Looks like
1. 1. First line
1) 1) First line
1: 1: First line
1 - 1 - First line
Tab 1→First line (a real tab)
Space 1 First line

A tab separator is useful when pasting into a spreadsheet: the numbers land in one column and the text in the next.

Zero padding. Without padding, line 9 and line 10 have different widths, so the text shifts. With padding, all numbers are the same width (001 to 120, for example), which keeps columns aligned and makes the lines sort correctly as text.

Don't number blank lines. Blank lines are kept in place, but they don't get a number and don't use one up. This is usually what you want for poems and paragraphs. Leave it off for code, where every line, including empty ones, should have a number that matches your editor.

Turning a list into a numbered list

To make a plain list into a numbered list for a document or email, paste it in with the "1. " separator. Many editors, including word processors and Markdown, recognise "1. " at the start of a line as a numbered list.

If you want to sort or tidy the list first, use the sort lines tool or remove duplicate lines. To add other text to the start or end of every line, such as bullet characters or HTML tags, use add prefix and suffix to lines.

Removing line numbers

If you've copied code from somewhere that included line numbers, you can remove them with the regex tester and a pattern like ^\s*\d+[.:)\-]?\s?, replacing matches with nothing. Many code editors also let you select a column of text with Alt or Option and delete it.

Line numbers in code editors

Most code editors and IDEs show line numbers in the margin without changing the file. The tool here is for when you need the numbers in the text itself: to paste into an email, a chat message, a ticket, a printed handout, or a document that doesn't support line numbering.

Other ways to transform lines

  • Combine lines into one: the comma separator joins lines with commas or other separators.
  • Remove line breaks: the remove line breaks tool turns lines back into paragraphs.
  • Repeat text: the text repeater duplicates lines or phrases.

Court documents, depositions and transcripts in many jurisdictions use numbered lines so that everyone can refer to the exact place in the text, such as "page 12, line 18". Many word processors have a line numbering option for this (in Word, under Layout > Line Numbers), which numbers lines as they appear on the printed page. The add line numbers tool numbers each line of your text as you've written it, which suits plain text, transcripts with a line per speaker turn, and documents shared outside a word processor.

Line numbers for poems and scripts

For poetry study, numbering every fifth line is traditional: set the step to 1 for the count, then keep only the numbers you need, or set the start and step to number only certain lines. For screenplays and stage scripts, numbering each line of dialogue makes rehearsal notes and edits easy to coordinate, especially when several people are working on the same draft by email.

Numbering code for sharing

When sharing code in chat, email or a document, it helps to:

  • Number every line, including blank ones, so references match the editor.
  • Use zero padding for longer snippets so columns stay aligned.
  • Use a monospace font where you paste it, such as a code block in chat apps.

Remember to remove the line numbers before running or reusing the code, or copy it from the original source instead. The add line numbers tool never changes your original text: it only creates a numbered copy in the result box.

Line numbers and plain text formats

Some plain text formats have their own line conventions. CSV files use one record per line, log files one event per line, and many configuration files one setting per line. Adding line numbers to a copy of these files makes it easy to point a colleague to a specific record or error, especially in emails or tickets. Use a tab separator if you're pasting the result into a spreadsheet, so the numbers land in their own column.

Numbering paragraphs instead of lines

If your text has paragraphs separated by blank lines and you want to number paragraphs rather than every line, make sure each paragraph is on a single line, then tick "Don't number blank lines". The remove line breaks tool can join wrapped lines back into single-line paragraphs first. This is useful for numbering clauses in contracts, items in meeting notes and points in feedback, and it keeps references like "paragraph 4" unambiguous when you add line numbers.

A worked example

A developer wants to ask a colleague about a 30-line function in a chat message, where the chat app doesn't show line numbers. She pastes the code into the tool, sets the separator to a space, ticks "Zero padding", and leaves "Don't number blank lines" off so the numbers match her editor. The result starts:

01 function total(items) {
02   let sum = 0;
03
04   for (const item of items) {

The tool shows 30 lines numbered. She can now ask, "Why does line 17 return early?"

Later, a teacher pastes a 14-line poem with a blank line between stanzas, chooses "1. " and ticks "Don't number blank lines". The poem's lines are numbered 1 to 14, with the stanza break kept and unnumbered.

Need more customers from Google?

This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. DeepRit is a Google Ads agency that does PPC and nothing else: we build the campaigns, block the searches that waste money, write the ads, set up conversion tracking and send you a short report every week. Request a free PPC audit and we will show you, in dollars, what we would fix first.

Frequently asked questions

How do I add line numbers to text?

Paste the text into the tool, choose a starting number, step and separator, and copy the result. Every line gets a number at the start.

Can I skip blank lines?

Yes. Tick "Don't number blank lines" to keep blank lines without numbering them.

How do I make all the numbers the same width?

Tick "Zero padding". Numbers are padded with leading zeros, such as 01 to 30.

Can I start numbering from a different number?

Yes. Set "Start at" to any number, and "Step" to count in 2s, 5s, 10s or any amount.

Can I put a tab after the number?

Yes. Choose "Tab" as the separator, which is handy when pasting into a spreadsheet.

Is it free to add line numbers here?

Yes. It's free, needs no sign-up, and your text stays in your browser.

Free PPC audit

See where your ad budget leaks.

We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.

Book a free audit call 30-minute call · Free · The audit is yours to keep