Text & Writing Tools

Add Line Numbers to Text Online

Paste your text or load a plain-text file, and the tool puts a number in front of every line. It runs in your browser, so the text stays on your device. You do not need an account. It is useful when you want to point to “line 12” in a list, a script, a poem, a log, or a code snippet.

3 characters

Options

Your text is processed in your browser and is not sent to a server by this tool.

Why use this tool?

Why use this tool?

Many editors show line numbers only in the left margin. Those numbers are not part of the text, so they disappear when you copy it into an email, a chat, or a document. This tool writes the numbers into the text itself. After that, they travel with the text wherever you paste it.

How to use it

How to use it

  1. Step 1

    Add your text

    Paste your text into the input area, or load a plain-text file.
  2. Step 2

    Set the options

    Choose the start number and the separator. Turn on Skip empty lines or Pad numbers with zeros if you need them.
  3. Step 3

    Check the lines

    Make sure each item you want numbered is on its own line. Press Enter where you want a break.
  4. Step 4

    Run the numbering

    Start the tool. Each line receives a number in order.
  5. Step 5

    Copy the result

    Copy the numbered text and paste it where you need it.

What this tool does

The tool reads the text you give it, splits it into lines, and adds a number to the start of each line, counting from the top. You then copy the numbered text or use it wherever you need it. It does not change the words themselves. It only adds the numbers.

How the tool works

Your text is split at every line break. Each piece between two line breaks counts as one line, and each line gets the next number in order. Because the split is based on real line breaks, a long sentence that only looks wrapped on your screen is still one line. If you want it counted as two lines, press Enter where you want it to break. You can change the start number, set your own separator between the number and the text, skip empty lines, and pad the numbers with zeros. All of this happens in your browser after the page has loaded.

Try it with sample text

Copy any sample below, paste it into the tool, and run it to see the numbers appear. Sample 1: shopping list Milk Eggs Bread Butter Coffee beans Olive oil Sample 2: short poem The sun comes up over the hill, The river is calm and still, A small bird sings a song, And the day moves slowly along. Sample 3: CSV rows name,age,city Rahim,28,Dhaka Sara,31,Chattogram Nadia,24,Sylhet Sample 4: log lines Server started Connected to database User logged in Warning: slow response User logged out

Add line numbers to selected text in Word, Notepad++ and TextEdit

Word has its own line numbering under the page layout options. It works across a section or the whole document and is meant for viewing and printing, so it is not a good fit when you only want to number one part. A simple workaround is to copy just that part, number it here, and paste it back. Notepad++ shows numbers in its left margin, but those are display-only and are not saved into your file. TextEdit on a Mac does not offer a simple way to insert line numbers into plain text. In all three cases, paste the text into this tool when you need the numbers to be real characters in the text.

Add line numbers to a textarea or text box

Most website forms and web apps that use a plain text box have no numbering option. Copy the text out of the textarea, number it here, and paste the result back in. The numbers will be part of the text, so check that the site does not mind extra characters at the start of each line.

Add line numbers to a text file in vim, Linux and Python

In vim, the command :set number shows numbers on screen but does not write them into the file. On Linux, running nl file.txt or cat -n file.txt in a terminal prints a numbered copy. In Python, a short loop such as for i, line in enumerate(open("file.txt"), 1): print(i, line, end="") does the same. These are fine if you are already working in a terminal. If you only need a quick one-off result, or you are on a phone or a computer without those tools, pasting the text here is faster.

Features explained

Splits text at line breaks

The tool treats each line break as the end of a line and numbers the lines in order. This keeps the result predictable: what you see as separate lines in the input box is what gets numbered. The limit is that wrapped text without a real line break counts as one line.

Start number

Numbering begins at 1 by default. Change it when your text is a continuation, for example an excerpt that starts at line 50. The next lines count up from the number you choose.

Separator

The separator is the text placed between the number and your line, such as a period and a space, a dash, or a colon. Choose what suits the place where you will paste the result. If you leave it empty, the number sits directly against the text.

Skip empty lines

When this is on, empty lines are skipped instead of being numbered. This suits text with blank lines between paragraphs. Leave it off if every line, blank ones included, should get a number.

Pad numbers with zeros

Adds leading zeros to the numbers so they look uniform, such as 001, 002, 010. It helps in long lists, where mixed-length numbers can make the text look uneven.

Works with pasted text or a plain-text file

You can paste text directly or use a standard text file. This covers notes, lists, scripts, CSV rows, logs, and code, because they are all plain text. Formatted documents such as Word or PDF files need their text copied out first.

Runs in your browser

The numbering is done by your browser, not by a server. That means no upload and no waiting for a transfer. Very large text depends on your device’s memory.

What can you use it for?

Teaching and study

Number the lines of a poem, a speech, or an exercise so students can say “look at line 7”.

Code and log sharing

Add numbers to a snippet or a log before you paste it into a chat or an email, so people can refer to the exact line.

Editing and review

Number a draft or a script so reviewers can give feedback by line.

Legal and transcript work

Number the lines of a transcript or a list of clauses so they can be cited precisely.

Lists and data rows

Number the rows of a CSV extract or a plain list to count items or point to a specific entry.

Tool information

Tool typeText utility
InputPasted text or a standard plain-text file
OutputThe same text with a number added to the start of each line
How lines are detectedText is split at line breaks (delimiter-based)
Start numberAdjustable, starts at 1 by default
SeparatorAdjustable text between the number and the line
Skip empty linesOptional, off by default
Pad numbers with zerosOptional, off by default
ProcessingIn your browser (client-side)
Server uploadNone
Account requiredNo
CostFree

Benefits

  • The numbers become part of the text, so they stay when you copy, paste, or print.
  • Nothing to install and no account to create.
  • The text is processed in your browser, so it is not uploaded.
  • Works for any plain text: lists, code, CSV rows, logs, scripts, poems.
  • The result is predictable because it follows your real line breaks.

Limitations

  • It numbers lines of text only. It does not edit Word or PDF files directly; copy the text out first.
  • Lines are counted by line breaks, not by how the text wraps on screen.
  • It does not understand code or document structure, so every line is treated the same way.
  • Empty lines get a number unless you turn on Skip empty lines.
  • Once added, the numbers are ordinary characters. If you want them gone later, you have to edit the text yourself.
  • Very large text depends on your device’s memory because everything runs in the browser.

Privacy and security

The text you paste or load is processed in your browser and is not uploaded to our server. Because nothing is sent, there is nothing for us to store. On a shared or public computer, close the tab when you finish so the text does not stay on screen.

Tips

  • If a long sentence should count as two lines, press Enter where you want the break before numbering.
  • Turn on Skip empty lines if blank lines between paragraphs should not get numbers. A trailing empty line at the end of your text is also a line and can get its own number.
  • Keep a copy of the original text. Removing numbers later is manual.
  • For a partial selection in Word, copy only that part, number it, and paste it back.

Frequently asked questions

Is this tool free, and do I need an account?

Yes, it is free, and no account is needed. You can use it without signing up.

Is my text uploaded anywhere?

No. The text is processed in your browser and is not sent to our server.

What kind of files can I use?

Standard plain text: pasted text, or files such as .txt, .csv, .log, .md, and code files. Word (.docx) and PDF files are not plain text, so copy their text into the tool.

Does it work offline?

The page needs internet to load the first time. After that, the numbering is done in your browser, so it should keep working if your connection drops while the page stays open.

How does the tool decide where a line starts and ends?

It splits the text at line breaks. Text that only looks wrapped on your screen, without a real line break, counts as one line. An empty line is also a line and gets a number, unless Skip empty lines is turned on.

How do I add line numbers to selected text in Word?

Copy only the part you want, number it in this tool, and paste the result back into Word. Word’s built-in line numbering works on a whole section instead of a selection.

Why don’t the numbers from Notepad++ or vim appear when I copy my text?

Those numbers are shown in the editor margin for reading only and are not saved in the file. To get numbers inside the text, paste the text here.

Can I use it on my phone?

Yes, in a modern mobile browser. Paste the text, run the tool, and copy the result.

Can I change the starting number or the separator?

Yes. You can set the start number (it begins at 1 by default) and the separator that goes between the number and your text. There are also two optional switches: Skip empty lines and Pad numbers with zeros.