Adding line numbers to a text file is useful for creating numbered lists, adding references to a document, or simply knowing how many items are in a list. Here's how to do it in seconds.

Add Line Numbers Online

Open remove-lines.com, paste your text, scroll to the Transform section, and enable Number Lines. Each line will be prefixed with its sequence number (1., 2., 3. etc.).

Number your lines now

Free, instant — no software, no sign-up.

Add line numbers →

Python: Adding Line Numbers

with open('input.txt') as f:
    lines = f.read().splitlines()

numbered = [f'{i+1}. {line}' for i, line in enumerate(lines)]

with open('output.txt', 'w') as f:
    f.write('\n'.join(numbered))

Command Line

# Linux/Mac with cat -n
cat -n input.txt

# Or with nl for more control
nl -ba input.txt

Combining with Other Options

Number Lines works best combined with Remove Duplicates and Sort A→Z — giving you a clean, sorted, sequentially numbered list in one step. This is particularly useful for creating numbered reference lists, FAQs, or ranked keyword sheets.

Removing Line Numbers

If you need to strip existing line numbers from a list, use a regex in any text editor: find ^\d+\.\s* and replace with nothing. This removes patterns like "1. ", "42. " etc. from the start of each line.