Add Line Numbers

Add a number before every line — neatly right-aligned — instantly in your browser. Useful for referencing lines in a list, code or instructions.

Text Tools Free No upload Instant

Loading Add Line Numbers…

Your browser is preparing the tool. It runs 100% locally.

Quick Answer

Paste text and the tool adds a number before each line, starting at 1 and counting up. The numbers are right-aligned — padded with spaces so they line up — and followed by a dot and a space. So a two-line list becomes 1. apple and 2. banana. The numbers become part of the text. Everything runs in your browser; nothing is uploaded.

What the Add Line Numbers Does

This tool puts a sequential number in front of every line of your text, so each line is labelled 1, 2, 3 and so on. The numbers are right-aligned and padded so they stay neatly in a column even when the count runs into double or triple figures.

It is the quick way to make a numbered version of a list, a code snippet or a set of instructions, so you can refer to a particular line by its number.

How It Works

The tool splits the text into lines and counts them. It works out how many digits the largest number needs, then prefixes each line with its number, right-aligned to that width and followed by a dot and a space. So in a nine-line block the numbers are one digit, and in a hundred-line block they are padded to three.

The right-alignment keeps the numbers in a tidy column, with the dots lining up, which makes the numbered text easy to read and to reference.

Processing pipeline

  1. Split into lines. Break the text into its separate lines.
  2. Find the width. Work out how many digits the largest line number needs.
  3. Number each line. Prefix each line with its number, right-aligned to that width, then a dot and a space.
  4. Rejoin. Put the numbered lines back together as the output.

How it numbers

each line → (right-aligned number) + . + space + the line numbers start at 1 · width = digits in the last line's number
Worked example
apple / banana → 1. apple · 2. banana

Numbers are right-aligned and padded to a common width, so they line up in a column. The numbers become part of the text, so removing them later needs a separate step.

Standards & references

  • Sequential numbering — Lines are numbered from 1 in order, each line getting the next number. It is a simple, one-based count of the lines as they appear.
  • Right alignment — Numbers are padded with spaces so they align to a common width, keeping the dots in a column. This matters once the count passes nine, so single and multi-digit numbers still line up.
  • Numbers as text — The numbers are added into the text itself, not shown separately. So the output includes them, and stripping them later requires removing the prefix from each line.

Accuracy & Limitations

The numbering is exact: every line gets the correct sequential number, right-aligned and padded so the column stays tidy however many lines there are.

The numbers become part of the text. That is what makes the output copyable as a numbered list, but it also means you cannot simply turn the numbers off — removing them later means stripping the prefix from each line.

It numbers every line, including blank ones. A blank line still gets its number, which keeps the count accurate but means empty lines are labelled too. Remove blank lines first if you do not want them numbered.

It counts lines as they are pasted, so wrapped text that is really one long line gets a single number. If your lines are soft-wrapped rather than hard line breaks, the numbering follows the actual line breaks, not the visual wrapping.

Real-World Use Cases

Numbering a list

Turn a plain list into a numbered one.

Referencing code lines

Add line numbers to a code snippet for discussion.

Labelling instructions

Number the steps in a set of instructions.

Citing specific lines

Make it easy to point to a line by number.

When to use it — and when not to

Good for

  • Numbering the lines of a list
  • Labelling code or instructions
  • Making lines easy to reference
  • A tidy, aligned number column

Not the best choice for

  • Numbering that updates as you edit
  • Custom number formats or starting points
  • Bulleted rather than numbered lists
  • Keeping the numbers separate from the text

For numbering that updates live, a code editor's line-number gutter keeps them separate from the text. For a different format or start number, edit the result by hand. This tool adds fixed numbers into the text.

Frequently Asked Questions

Where does the numbering start?
At 1. The first line is numbered 1, the second 2, and so on in order. The numbers count the lines as they appear in your text.
Why are the numbers padded with spaces?
To right-align them so they line up in a column. Without padding, a single-digit number and a two-digit number would not align; padding keeps the dots in a tidy column.
Do the numbers become part of the text?
Yes. They are added into the text itself, so the output is a numbered version you can copy. To remove them later, you strip the number prefix from each line with another step.
Does it number blank lines?
Yes. Every line, including a blank one, gets its number, which keeps the count accurate. If you do not want blank lines numbered, remove them before numbering.
Can I start from a different number?
The tool starts at 1. To begin elsewhere, you would adjust the numbers by hand after generating, since it always counts from one.
Can I change the format, like 1) instead of 1.?
The format is a number, a dot and a space. For a different style such as a closing bracket, edit the output, since the prefix is fixed.
What if my text has hundreds of lines?
The numbers are padded to the width of the largest, so a hundreds-long block uses three-digit numbers and everything stays aligned. The numbering scales to any number of lines.
Does it keep my line breaks?
Yes. It works line by line and keeps the lines as they are, simply adding a number in front of each. The structure of your text is preserved.
Is this the same as a code editor's line numbers?
Similar in look, but an editor shows numbers in a separate gutter that updates as you edit. This tool writes the numbers into the text, so they become part of the content you copy.
Can I remove the numbers again?
Not with this tool. To strip them, use a find-and-replace with a pattern that matches the number prefix at the start of each line, which removes them and leaves the original text.
Is my text uploaded?
No. The numbering runs entirely in your browser. Nothing is sent to a server, so your text stays on your device.
Why right-align rather than left-align the numbers?
Right-aligning keeps the dots and the start of each line in a straight column, which reads more cleanly than left-aligned numbers, where the text would shift as the number width changes.

References

Prefixes each line with a sequential number starting at 1, right-aligned to the width of the largest number, followed by a dot and a space.

PopularHot

Word Counter

Clean and transform text with Word Counter — instant results, fully in-browser.

TextOpen Tool
Popular

Character Counter

Character Counter instantly as you type — free, private and lightning fast.

TextOpen Tool
Popular

Case Converter

Case Converter instantly as you type — free, private and lightning fast.

TextOpen Tool
Trending

Lorem Ipsum Generator

Clean and transform text with Lorem Ipsum Generator — instant results, fully in-browser.

TextOpen Tool
Trending

Text Diff Checker

Text Diff Checker online with no limits, no signup and no data leaving your browser.

TextOpen Tool

Remove Duplicate Lines

Remove Duplicate Lines online with no limits, no signup and no data leaving your browser.

TextOpen Tool

Ready to try the Add Line Numbers?

It is free, private and runs entirely in your browser — no sign-up, no uploads, no limits.