Add Line Numbers

Paste text to number every line, or switch to Remove numbers to take them off code or a list you copied with numbers in it.

How it works

Add numbers puts a number in front of every line, empty lines included, so the numbers match the line numbers in an editor. You choose the first number, the style such as "1." or "1)" or "1 |", and whether the numbers are lined up.

Line up with spaces pads the shorter numbers on the left, so lines 1 to 9 start in the same column as line 10. Leading zeros pads with zeros instead, as in 01, 02, up to 10.

Remove numbers takes a number off the start of each line when it is followed by a dot, a bracket, a colon, a tab, a dash, a bar or a space. It is the way back from any of the styles here. Everything runs on this page.

How to use it

  1. 1 Paste your text into the Text box.
  2. 2 Choose Add numbers or Remove numbers.
  3. 3 When adding, set Start at, pick a Style and choose the Padding.
  4. 4 Copy the result, or download it as a .txt file.

Good to know

  • To quote lines 40 to 60 of a file with their real numbers, paste just those lines and set Start at to 40.
  • Leading zeros keep numbered file names in order in a folder that sorts them as text.
  • The tab style pastes into a spreadsheet as two columns: the numbers and the lines.
  • Line breaks are kept as they were, so numbering a Windows file keeps its Windows line breaks.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Copying code out of a tutorial that printed its line numbers

Tutorials and PDF books often print code with a line number on every line. Copy that code and the numbers come with it: "1 import os", "2 import sys", "10 def main():". The code will not run until every number is gone, and deleting them by hand from 80 lines is slow and easy to get wrong. Paste it here, choose Remove numbers, and each line loses its number and the space after it.

Removing works with the common styles: "1.", "1)", "1:", "[1]", "(1)", "1 -", "1 |", a number followed by a tab, and a number followed by a space. Spaces before the number are removed too, because many printouts pad the numbers so they line up. Only one space after the number is taken, so the indentation of the code under it stays intact. That matters in Python, where indentation is part of the program.

Adding numbers is the opposite job. Say you are asking for help with a 25-line config file and want to point at "line 14". Paste it, choose Add numbers, and pick Line up with spaces, so lines 1 to 9 get a space in front and line up with lines 10 to 25. If you are quoting lines 40 to 60 of a longer file, paste only those and set Start at to 40, so the numbers match the file. The note under the result confirms the range, such as "Numbered 21 lines, 40 to 60".

The style changes what the numbers are good for. "1." reads well in a document. "1 |" looks like an editor's gutter in a chat message. A tab after the number pastes into a spreadsheet as two columns. Leading zeros, as in 001 to 120, keep names in the right order in any program that sorts them as plain text.

The tool has limits. Remove numbers cannot tell a line number from a number that is part of the text, so a line that begins "2024 was a good year" loses its 2024 as well. Check the note, which counts how many lines lost a number. Empty lines are always numbered when adding. The tool takes up to 1 MB of text at a time.

Frequently asked questions

Are empty lines numbered?

Yes. Every line gets a number, so the numbers match what an editor shows. Remove Empty Lines first if you want only the lines with text numbered.

Can I start from 0 or from a negative number?

Yes. Start at takes any whole number, and the padding still lines the numbers up, minus signs included.

Which numbers does Remove numbers take off?

A number at the very start of a line, after any spaces, followed by a dot, a bracket, a colon, a tab, a dash, a bar or a space. A number like 3.5 is kept, because the dot is followed by a digit.

Is my text sent anywhere?

No. The numbering runs in your browser, on this page.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.