piapia123
en

Line Numbering

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Put a number at the start of every line, or take an existing one away. Stripping is the part that goes wrong. A date like `2026.09` and a time like `3:00` both look like “digits followed by a separator”, so a loose rule cuts them off and the sentence breaks in the middle. This tool therefore reuses the rule already tuned in the text cleaner: digits, then an unambiguous separator, then whitespace. Both tools will always agree on what counts as a line number. Unnumbered blank lines do not consume a number either. If they did, the sequence would visibly skip — which is the one thing someone ticking that option does not want. Padding is skipped for negative numbers. `String(-1).padStart(4, '0')` yields `00-1`, with the minus stranded in the middle. That only happens when the start value is negative, so the sign is checked before padding.

Features

  • Six styles: dot, closing parenthesis, parentheses, brackets, ideographic comma and colon
  • Adjustable start and step (a negative step numbers backwards)
  • Optional zero padding, skipped for negative numbers so `00-1` never appears
  • Blank lines can be left unnumbered and uncounted, so the sequence never skips
  • Stripping recognises the same six styles, including the form without a trailing space
  • Dates and times are never mistaken for numbering
  • Adding and stripping share one rule, so a round trip returns the original
  • Everything runs locally in your browser; nothing is uploaded

How to use

  1. Paste the text you want to number
  2. Choose Add numbers or Strip line numbers
  3. When adding, pick a style and adjust the start, step and padding if you need to
  4. Click Copy to take the result

FAQ

Will stripping also eat numbers inside the text?
No. The rule requires digits followed by an unambiguous separator (a dot, a bracket, a colon and so on) and whitespace after that separator. In `2026.09 published`, the `2026.` is followed by a digit rather than whitespace, so it is left alone; the same goes for `3:00`. The only relaxation is the ideographic comma form, which is unambiguous without a space.
I left blank lines unnumbered but the sequence still skips. Why?
A number can only skip for two reasons: the option is not in effect (check that the dropdown is not still on Strip), or the “blank” lines actually contain spaces or tabs. A line holding only spaces is not an empty string, so it is numbered like any other. Clean the line endings first with the text cleaner, then number.
Why are negative numbers not zero-padded?
Because `String(-1).padStart(4, '0')` gives `00-1` — the minus sign ends up in the middle of the digits. Padding is therefore applied to non-negative numbers only and negatives are written as they are. For a countdown such as `-3 -2 -1`, padding would not mean much anyway.

Related tools