Add Line Numbers

Add line numbers to any text or code online. Free online line number generator - customize format and starting number.

🔒 Your text stays in your browser - nothing is sent to our servers
Input
0Characters
0No spaces
0Words
0Sentences
0Lines
< 1 minRead time
Result
How to Use

Three steps to get started

1

Paste your text

Paste any multi-line text - a list, code snippet, or document.

2

Numbers added

Each line gets a sequential number prepended in your chosen format.

3

Copy or download

Click Copy or download the numbered text as a .txt file.

About This Tool

What does adding line numbers do?

Adding line numbers means prefixing each line of a block of text with its sequential position, turning loose lines into an addressable list. The numbers become part of the text itself - unlike the gutter numbers your editor draws beside a file, these are real characters that survive copy, paste, screenshot, and email.

That distinction is the whole reason the tool exists. VS Code, Sublime, and GitHub all display line numbers, but none of them include those numbers when you copy a selection. Paste the snippet into Slack or a bug report and every reference to "line 42" loses its anchor. Baking the numbers in keeps the conversation aligned, which is why RFC documents, legal contracts, and legislative drafts have used numbered lines for decades - deposition transcripts in US courts are conventionally set at 25 numbered lines per page precisely so testimony can be cited as page:line.

Situations where this is the fastest fix:

  • Code review over chat - paste a numbered snippet so reviewers can say "line 7 leaks the handle"
  • Documentation and tutorials - annotate a config file step by step
  • Turning a rough list into ordered steps - bullets or bare lines become 1., 2., 3.
  • Adding a synthetic ID column to CSV or TSV rows before import
  • Manuscript and contract markup - give editors a stable way to reference a passage
  • Log triage - number an excerpt before pasting into a ticket

Which numbering format should you pick?

"1. " with a trailing period is the safest default and is what Markdown recognises as an ordered list, so the output stays semantically meaningful if pasted into a README or a wiki. "1) " with a closing parenthesis avoids that behaviour, which is exactly what you want when the numbers should stay literal rather than being re-rendered by a Markdown engine.

Zero-padded numbering pads to the width of the largest line number, so a 120-line document produces 001 through 120 and every line of text starts at the same column. This matters more than it sounds: padded numbers also sort correctly as strings, so 009 comes before 010 instead of the lexicographic mess where 10 lands before 9. Blank lines are counted like any other line, matching how editors and diff behave. Nothing you paste is uploaded - the numbering runs on your own machine, so proprietary source and confidential drafts are safe to drop in.

FAQ

Frequently Asked Questions

Related Tools