Add Line Numbers

Add line numbers to text with our free online tool. Customize the starting number, increment, and format, then copy or download your results.

Your Text

Numbered Text

Numbering Options

The number assigned to the first line.

The amount added to each number. Use a negative value to count down.

Choose how the line numbers are displayed.

Add zeros or spaces before numbers to keep them aligned.

0 Total Lines
0 Numbered Lines
0 Skipped Lines

How to Add Line Numbers to Text

Our free online line numbering tool lets you automatically add numbers to each line of text. You can number lists, code, documents, notes, and other multiline content without entering every number manually.

Follow these steps to add line numbers:

  1. Paste or type your original text into the Your Text box.
  2. Enter the starting number and increment, or leave both set to 1.
  3. Choose your preferred number format and padding options.
  4. Decide whether empty lines should be numbered or skipped.
  5. Copy the automatically generated text or download it as a TXT file.

The results update instantly whenever you enter text or change the numbering options. There is no need to click a separate generate button.

What Is a Line Numbering Tool?

A line numbering tool adds a number to the beginning of each line in a block of text. It makes it easier to identify, reference, and organize individual lines.

Unlike the line numbers displayed in many word processors and code editors, this tool inserts the numbers directly into the text. The numbers remain present when you copy, download, or paste the results into another application.

Original Text

Apple
Banana
Orange
Strawberry
Watermelon

Numbered Text

1. Apple
2. Banana
3. Orange
4. Strawberry
5. Watermelon

If you only need to determine how many lines your text contains, use our Line Counter. You can also use our Character Counter to check the number of characters, words, spaces, and other text statistics before or after adding line numbers.

Customize Your Line Numbers

The numbering options allow you to control how each line is numbered and how the numbers appear in the final text.

Change the Starting Number

Line numbering starts at 1 by default. You can change the starting number to zero, 100, or another whole number.

This is useful when numbering a section of a larger document or continuing an existing numbered list.

Starting at 0

0. Apple
1. Banana
2. Orange

Starting at 100

100. Apple
101. Banana
102. Orange

Change the Numbering Increment

The increment determines how much the number changes between numbered lines. An increment of 1 produces consecutive numbers, while an increment of 5 increases each number by five.

You can also enter a negative increment to generate numbers in descending order. The increment must be a nonzero whole number.

Increment of 5

5. Apple
10. Banana
15. Orange

Increment of -1

3. Apple
2. Banana
1. Orange

Choose a Numbering Format

Choose from several numbering formats to match the style of your document, list, or other text.

Format Example
Period 1. Apple
Parenthesis 1) Apple
Parentheses (1) Apple
Colon 1: Apple
Brackets [1] Apple
Space 1 Apple
Tab 1 Apple
Custom Separator 1 - Apple

To create your own format, select Custom Separator and enter the characters you want to appear between each number and its corresponding line of text.

Add Leading Zeros or Spaces

Number padding helps keep line numbers aligned when they contain different numbers of digits.

Select Leading Zeros to produce numbers such as 001, 002, and 003, or select Leading Spaces to align numbers without adding extra zero digits.

Without Padding

8. Apple
9. Banana
10. Orange

Leading Zeros

08. Apple
09. Banana
10. Orange

Leading Spaces

 8. Apple
 9. Banana
10. Orange

Minimum Width of 3

008. Apple
009. Banana
010. Orange

When the minimum number width is left blank, the tool automatically calculates the width needed for the generated numbers. Enter a minimum width if you want additional padding. Numbers are never shortened or truncated.

Add Line Numbers Without Numbering Empty Lines

Text often contains blank lines between paragraphs, sections, or groups of items. The Skip empty lines option allows you to preserve those lines without assigning numbers to them.

This option is enabled by default. Empty lines and lines containing only whitespace are skipped without advancing the numbering sequence.

Skip Empty Lines Enabled

1. Apple
2. Banana

3. Orange
4. Grape

Skip Empty Lines Disabled

1. Apple
2. Banana
3.
4. Orange
5. Grape

Skipping empty lines does not delete them. If you want to remove unnecessary line breaks instead, use our Remove Line Breaks tool.

Add Line Numbers to Code

Adding line numbers to source code is useful when sharing programming examples, reporting errors, preparing tutorials, or discussing particular lines with other developers.

The tool preserves the original indentation, spaces, and tabs in your code while adding numbers to the beginning of each line.

Original Code

function greet() {
    console.log("Hello!");
}

greet();

Numbered Code

1. function greet() {
2.     console.log("Hello!");
3. }

4. greet();

Disable Skip empty lines if you want the generated numbers to correspond to every physical line in a source file, including blank lines.

Remember that these numbers become part of the copied text. Numbered code is generally intended for reference and documentation rather than direct execution.

Add Numbers to Lists

You can quickly turn an unnumbered list into a numbered list by placing each item on a separate line.

Original List

Buy groceries
Send email
Finish report
Call dentist

Numbered List

1. Buy groceries
2. Send email
3. Finish report
4. Call dentist

If your list needs to be organized first, use our Sort Lines tool to rearrange the items or our Remove Duplicate Lines tool to eliminate repeated entries. You can then paste the resulting list into the line numbering tool.

Add Line Numbers for Excel and Google Sheets

The tab numbering format is useful when preparing text for a spreadsheet. It places a tab character between the line number and the original text.

When you paste the tab-separated result into Excel or Google Sheets, the numbers and text can appear in separate columns.

For best results, use one item per line and make sure the original items do not contain unwanted tab characters, which may create additional columns.

How Are Lines Numbered?

The tool identifies lines using actual line break characters in the original text. It supports common Windows, macOS, Linux, and Unicode line separators.

A long line that wraps visually inside the text box is still treated as one line unless it contains an actual line break. A final line break is preserved without creating an additional numbered line after it.

If you want to divide a long block of text into smaller sections before numbering it, try our Text Splitter.

Understanding the Line Statistics

The statistics below the numbering options update automatically as you enter text and adjust the settings.

Statistic Description
Total Lines The number of lines in the original text, including blank lines.
Numbered Lines The number of lines assigned a line number.
Skipped Lines The number of blank or whitespace-only lines that were not numbered.

When numbering is successful, the sum of Numbered Lines and Skipped Lines equals the total number of lines in your original text.

Free Browser-Based Line Numbering

The line numbering operation takes place locally in your web browser using JavaScript. The text you enter does not need to be uploaded to a server for processing.

You can add line numbers to text without creating an account, installing software, or paying for access. The tool works on desktop computers, tablets, and mobile devices.

Frequently Asked Questions

How do I add line numbers to text online?

Paste your text into the Your Text box. The tool automatically adds a number to each line and displays the result in the Numbered Text box. You can customize the numbering options before copying or downloading the result.

Can I start line numbering at zero?

Yes. Enter 0 in the Starting Number field to begin numbering at zero. You can also enter another supported whole number, including a negative starting number.

Can I add line numbers in descending order?

Yes. Enter your desired starting number and use a negative increment. For example, a starting number of 10 and an increment of -1 produces the sequence 10, 9, 8, 7, and so on.

How do I add leading zeros to line numbers?

Select Leading Zeros from the Number Padding dropdown. Enter a minimum number width of 3 to generate numbers such as 001, 002, and 003.

Can I skip blank lines when numbering text?

Yes. The Skip empty lines option is enabled by default. Blank lines and whitespace-only lines remain in the result but are not assigned line numbers.

Does the tool remove existing line numbers?

No. This tool adds new numbers to the beginning of your lines without removing existing text or numbers. If your text already contains line numbers, those numbers will remain in the output.

Does the tool preserve indentation?

Yes. The original spaces, tabs, punctuation, and indentation are preserved. The generated numbering is inserted before the original contents of each numbered line.

Are visually wrapped lines numbered separately?

No. Only actual line breaks are used to identify separate lines. Text that wraps onto another visible row because of the width of the text box remains part of the same numbered line.

Can I use a custom separator after each number?

Yes. Select Custom Separator from the Number Format dropdown and enter the separator you want to use. For example, entering a space, hyphen, and another space produces numbered lines such as 1 - Apple.

Will the line numbers remain when I copy the text?

Yes. The line numbers are inserted directly into the output text. They remain present when you copy the results into a document, email, text editor, or another application.

Can I download the numbered text?

Yes. Click Download TXT to save the numbered text as a plain-text file. The file includes the selected numbering format, padding, original text, and line breaks.

Is this line numbering tool free?

Yes. The Add Line Numbers tool is completely free to use. No registration, subscription, or software installation is required.