Line numbering
What is a Line Numbering Tool?
Line numbers make it easy to refer to a specific line in a code snippet, a log excerpt, a contract or a poem. Sometimes you need the opposite: code copied from a book or website arrives with numbers you must strip before running it. This tool adds or removes line numbers with full control over the format.
How to use it
- Paste the text.
- To add numbers, choose the starting number, step, padding and separator.
- To remove numbers, use the strip option.
- Copy the result.
Examples
Input:
SELECT *
FROM users
WHERE active = 1;Numbered from 1 with a padding of 2 and the separator : :
01: SELECT *
02: FROM users
03: WHERE active = 1;Numbered from 10 with a step of 10, BASIC style:
10 SELECT *
20 FROM users
30 WHERE active = 1;Options explained
- Start: the first number, useful when quoting lines 120 to 140 of a file.
- Step: the increment between lines.
- Padding: leading zeros or spaces so numbers align, which matters past line 9.
- Separator: a tab, colon, period or pipe between the number and the text.
Tips
- For code in documentation, prefer the line-number feature of your syntax highlighter, so readers can still copy the code without numbers.
- When stripping numbers, check that the pattern only removes the leading number and separator, not numbers that are part of the content.
- On the command line,
nlandcat -nadd line numbers.
Frequently Asked Questions
How do I add line numbers to text?
Paste the text, choose the starting number, step, padding and separator, and copy the numbered output.
Can I remove line numbers from copied code?
Yes. Use the strip option to remove leading numbers and separators from each line.
Why use zero padding?
Padding keeps numbers the same width so the text after them stays aligned.
Are blank lines numbered?
Each line, including blank ones, normally receives a number so references stay accurate.