Add Line Numbers to Text
Quickly add line numbers to a block of text for sharing code snippets, log excerpts, or referencing specific lines in a review. Optional zero-padding, custom starting number, custom separator. The reverse mode strips existing line numbers.
How to use the Add Line Numbers to Text
Paste text. Pick add or strip mode. Configure start number, padding (so all numbers align), and the separator between number and line. Output updates live.
Adding (and removing) line numbers
Line numbers make a snippet referenceable — “see line 14” only works if the lines are numbered. They help when sharing code in a chat without a gist, quoting a config file in a review, or printing a listing. But you also need to strip the numbers off again before the code will run.
This adds line numbers with control over the starting number, zero- or space-padding so they align, and the separator between number and text. Strip mode reverses the process, removing existing numbering so you get the clean original back. To measure each line’s length rather than number it, see character count by line.
Common use cases
- Code sharing — number a snippet so others can point to a specific line.
- Review comments — quote a config file with line references.
- Teaching — hand out a numbered listing for discussion.
- Log excerpts — number lines of a captured log for reference.
- Round-tripping — strip numbers back off text that was already numbered.
Frequently asked questions
Can it remove line numbers too?
Why pad the numbers?
Can I start from a number other than 1?
Is the separator configurable?
: or a tab.