Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)

Add Line Numbers

Add line numbers or custom prefixes to each line of text. Supports numbered formats, bullet points, and custom patterns.

What is Add Line Numbers?

Add Line Numbers is a text formatting tool that adds line numbers or custom prefixes to each line of your text. Whether you need numbered lines for code review, bullet points for lists, or quote markers for citations, this tool makes it quick and easy.

Who Uses This Tool?

This tool is useful for anyone who works with text:

Developers

Add line numbers to code snippets for documentation or code reviews

Writers and Editors

Number paragraphs for reference or add bullet points to lists

Teachers and Students

Format study notes, create numbered outlines, or prepare reference materials

Legal Professionals

Number lines in contracts or legal documents for easy reference

Content Creators

Format text for blogs, social media, or presentations

Key Benefits

Flexible Formatting

Use numbered formats like "1. " or "1) ", or static prefixes like "* " or "> "

Custom Patterns

Create your own format using $n as the line number placeholder

Live Preview

See results instantly as you type or change settings

Works with Any Text

Process code, prose, lists, or any plain text content

Your Text Stays Private

100% Privacy Guaranteed: All text processing happens entirely in your browser. Your text never leaves your device, no server processing occurs, and we don't collect or store any of your content.

How to Use Add Line Numbers

Adding line numbers or prefixes to your text takes just a few steps. Here's how to get started:

1

Enter Your Text

Paste or type your text in the Input panel on the left. Each line will be processed separately. You can also click the Paste button to quickly paste from your clipboard.

2

Choose a Format

Select how you want each line to be prefixed:

  • Use a Preset - Click one of the preset buttons like $n., *, or -
  • Enter a Custom Format - Type your own format in the Format field. Use $n as a placeholder for the line number
3

Adjust Settings (Optional)

Fine-tune the output with these options:

  • Start - Set the starting number (default is 1). Only visible when using $n
  • Padding - Align numbers with spaces. "Left" right-aligns numbers, "Right" left-aligns them
  • Skip Empty - When enabled, empty lines won't receive a prefix
4

Copy or Download

Once you're satisfied with the result:

  • Click Copy to copy the formatted text to your clipboard
  • Click Download to save the result as a text file
  • Click Swap to move the output back to input for further processing

Format Examples

Format Input Output
$n. Apple
Banana
1. Apple
2. Banana
[$n] First
Second
[1] First
[2] Second
* Item A
Item B
* Item A
* Item B
> Quote here > Quote here

Keyboard Shortcuts

Speed up your workflow with these keyboard shortcuts:

  • Ctrl + Shift + C - Copy the output
  • Ctrl + Shift + X - Clear all text

Features

Add Line Numbers offers flexible text formatting options to suit different needs:

Numbered Line Formats

Add sequential numbers to each line using the $n placeholder. The number automatically increments for each line:

Standard Numbering

  • $n. → 1. First line, 2. Second line
  • $n) → 1) First, 2) Second

Bracketed Numbers

  • [$n] → [1] First, [2] Second
  • #$n → #1 First, #2 Second

Custom Text with Numbers

  • Line $n: → Line 1: First, Line 2: Second

Static Prefixes

Add the same prefix to every line - perfect for bullet points, quotes, or indentation:

Prefix Use Case Example
* Bullet points for unordered lists * Item one
- Dash lists, common in Markdown - Item one
> Quote markers for citations or email replies > Quoted text
Two spaces for indentation Indented text

Custom Start Number

Begin numbering from any number you choose. Useful when:

  • Continuing a numbered list from a previous section
  • Starting from zero (common in programming)
  • Creating numbered items that start at a specific value

Number Padding

Align numbers neatly when working with many lines:

None

Numbers as-is: 1, 2, ... 10, 11, ... 100

Left (Right-align)

Adds leading spaces: " 1", " 10", "100"

Right (Left-align)

Adds trailing spaces: "1 ", "10 ", "100"

Skip Empty Lines

When enabled, empty lines remain empty without receiving a prefix. This keeps your formatting clean when working with text that has blank lines between paragraphs.

Live Preview

The output updates in real-time as you:

  • Type or paste text in the input
  • Change the format pattern
  • Adjust any settings

Swap Function

The Swap button moves your output back to the input, allowing you to apply multiple formatting passes. For example:

1

First Pass

Add line numbers with $n.

2

Swap

Move output to input

3

Second Pass

Add quote prefix with >

4

Result

> 1. First line

Export Options

Copy to Clipboard

Copies formatted text to clipboard with one click

Download as File

Saves the result as a .txt file

Frequently Asked Questions

What does $n mean in the format?

$n is a placeholder that gets replaced with the line number. For example, if your format is Line $n: , the output will be "Line 1: ", "Line 2: ", etc. If your format doesn't contain $n, every line gets the same prefix.

Can I use multiple $n in one format?

Yes, each $n in your format will be replaced with the same line number. For example, [$n-$n] produces "[1-1] ", "[2-2] ", and so on.

How do I add bullet points instead of numbers?

Simply enter a format without $n. Click the * or - preset button, or type your own static prefix like or .

Why can't I see the Start and Padding options?

These options only appear when your format contains $n (line numbers). They're hidden for static prefixes since they don't apply.

What does "Skip Empty" do?

When enabled, empty lines in your text won't receive any prefix or number. They remain blank. When disabled, empty lines get the prefix too (resulting in lines that only contain the prefix).

How does Padding work?

Padding adds spaces to align numbers neatly:

  • Left - Right-aligns numbers by adding spaces before: " 1", " 10", "100"
  • Right - Left-aligns numbers by adding spaces after: "1 ", "10 ", "100"
  • None - No padding, numbers vary in width

What is the Swap button for?

Swap moves the output text back to the input field. This lets you apply multiple formatting passes. For example, first add line numbers, then swap and add a quote prefix on top.

Is there a limit to how much text I can process?

There's no strict limit, but very large texts (tens of thousands of lines) may slow down your browser since all processing happens locally. For best performance, work with text under 10,000 lines at a time.

Is my text private?

Yes, completely. All processing happens in your browser using JavaScript. Your text is never uploaded to any server. You can even use this tool offline after the page loads.

Can I use special characters in my format?

Yes, you can use any characters in your format including Unicode symbols, emojis, or special punctuation. Just type them directly in the Format field.

Presets
Use $n for line number
Input
Output
Lines 0
Processed 0
Skipped 0
Enter your format using $n as placeholder for line number
Use presets like $n., *, or - for quick formatting
Enable Skip Empty to ignore blank lines
Use Swap to apply multiple prefixes in sequence
All processing happens locally - your text never leaves your browser
Want to learn more? Read documentation →
1/6
Start typing to search...
Searching...
No results found
Try searching with different keywords