{{ outputText }}
ℹ️ About Add Line Numbers
Add Line Numbers prefixes each line of plain text with a sequential line number, creating stable references without changing the original line order. It is useful when you need editor-style line references for code snippets, logs, transcripts, procedures, legal drafts, or documentation excerpts.
Practical uses:
- Code review: add line references to pasted source, stack traces, shell output, or configuration files.
- Documentation: turn instructions, checklists, meeting notes, or policy text into numbered reference material.
- Data cleanup: mark each record in a newline-delimited list before sorting, comparing, or sharing it.
- Publishing: produce padded line numbers for examples that should align neatly in monospaced text.
Technical behavior:
- Simple format outputs values such as
1: text, while padded format outputs values such as001: text. - Custom format replaces
{line}with the current number and{text}with the original line content. - Start Number and Increment control the sequence; both are normalized to positive integers.
- Skip empty lines preserves blank lines without assigning or consuming a line number.
- Padding Width is capped at 20 characters to keep output readable and predictable.
Examples: input lines alpha and beta become 1: alpha and 2: beta in simple mode. With padded width 3, they become 001: alpha and 002: beta. A custom template such as [L{line}] {text} produces [L1] alpha.
Line numbering follows the same general text-filtering idea as command-line utilities such as the POSIX nl utility and GNU Coreutils nl / cat options, adapted here for browser text editing with custom templates.
Privacy note: the interactive page applies numbering in your browser as you type. If you use the API example, send only text you are comfortable processing on the server.
API Usage Example:
POST /api/tools/text/add-line-numbers
Content-Type: application/json
{
"text": "First line\nSecond line",
"startNumber": 1,
"increment": 1,
"format": "simple",
"customFormat": "{line}: {text}",
"padding": 3,
"skipEmptyLines": false
}