Add Prefix, Suffix and Line Numbers
Prefix, suffix, number, reverse, filter and wrap lines. Runs in your browser.
About this add prefix, suffix and line numbers
These line tools add a prefix or suffix to every line, number lines, reverse them, remove empty lines, keep or drop lines that contain a word, and wrap long lines at a set width. They are for people who work with lists: keyword lists, product codes, to-do items, log lines, CSV columns and anything else that comes one item per line.
All six tools live on one page and share the same input, so you can chain them. Filter a list down to the lines you want, press Use as input, then number what is left. The result updates as you type, and your text stays in your browser.
For sorting and shuffling, use sort text lines, and to drop repeats, remove duplicate lines handles the case and spacing traps.
Features
Prefix and suffix with line numbers
Add text to the start and end of each line. Type {n} anywhere in either box to insert the line number, so item-{n}: becomes item-1:, item-2: and so on. Quick presets cover bullets, task boxes, quoted lists and <li> tags.
Number lines your way
Pick a start number, a step (use -1 to count down) and a format such as 1. or (1) or [1], or write your own. Zero padding gives 001 to 120 so the numbers line up, and empty lines can be skipped so they do not take a number.
Remove empty lines
Delete blank lines, including lines that only hold spaces or tabs. Or keep a single blank line between paragraphs and remove only the extra ones.
Filter lines by a word
Keep lines that contain, do not contain, start with or end with your text. Separate several words with commas to match any of them, and turn on whole words or match case when you need to be exact.
Wrap at a fixed width
Wrap long lines at any width from 10 to 200 characters, breaking at spaces. Leading spaces, > quote marks and // comment markers repeat on the wrapped lines, which keeps quoted emails and code comments tidy.
How to use the add prefix, suffix and line numbers
- 1Pick a tool: prefix/suffix, number, reverse, remove empty, filter or wrap.
- 2Paste your lines and adjust the options for that tool.
- 3Copy the result, or press Use as input to run another tool on it.
When to use it
Building a SQL IN list or an array
Paste a column of IDs and pick the '…', preset. Every line becomes something like 'A102', ready to go between brackets. To get them all on one line, join the result in remove line breaks with a space as the separator, then delete the last comma.
Turning notes into a checklist
Use the - [ ] preset to turn plain lines into Markdown task items for GitHub, Obsidian or Notion. Empty lines are skipped, so section gaps stay as they are.
Pulling matching lines out of a log
Paste a server log and keep the lines that contain ERROR, WARN. Switch to do not contain to hide noisy health checks instead. For patterns more complex than plain words, the regex tester shows every match.
How do I add text to the beginning of every line?
Open the Prefix / suffix tool, type what you want in the Prefix box, and every line in the result starts with it. Leave Skip empty lines on so blank lines do not end up holding a lonely prefix. Trim spaces first removes any indentation before the prefix goes on, which matters when you paste from a spreadsheet or a PDF.
In a code editor you can do the same with multi-cursor editing or a regular expression that replaces ^ with your prefix. That is fine for 20 lines. For 5,000 lines pasted from an export, or when you need a running number inside the prefix, a dedicated tool is faster and harder to get wrong.
What does wrapping at 72 or 80 characters mean?
Fixed-width wrapping is a habit from terminals and plain-text email. Commit messages in Git are usually wrapped at 72 characters, Python's style guide (PEP 8) suggests 79 for code and 72 for comments and docstrings, and RFC 5322 recommends that email lines stay under 78 characters.
Choose the width with the slider or one of the presets. Words longer than the width are split when Split words longer than the width is on. With it off, a long URL stays in one piece and simply runs past the limit, which is usually what you want for links.
- 72: Git commit bodies, plain-text email
- 79 to 80: classic terminals and many code style guides
- 100 or 120: modern code style limits
Chaining tools without losing work
Use as input copies the result back into the input so you can apply the next tool, and the page address remembers which tool is open. Line endings are kept too: a file with Windows CR LF breaks comes out with CR LF, and a final newline stays, which keeps diffs clean when the result goes back into a repository.
Why use Mavros
| Mavros | Typical upload sites | |
|---|---|---|
| Tools on one page | Six, sharing one input | One tool per page |
| Line number inside a prefix | Yes, with {n} | Rare |
| Chain several steps | Use as input button | Copy and paste between pages |
| Filter by several words | Comma-separated, whole words, match case | One word, case-sensitive |
| Privacy | Runs in your browser | Often processed on a server |
Tips
- Put {n} in a prefix or suffix to number lines and add text in one step, such as Step {n}: or row_{n},.
- Filter with commas between words to match any of them: apple, pear, plum keeps every line with at least one of those words.
- Turn on whole words when filtering short terms. Without it, cat also matches category and concatenate.
- Wrap with the indent option on when you are rewrapping a quoted email, so every line keeps its > marker.
Questions
How do I add a prefix and suffix to each line?
Choose Prefix / suffix, type the text for the start of each line in Prefix and the text for the end in Suffix. The result updates straight away, and empty lines are skipped unless you turn that option off.
How do I number lines in a text?
Choose Number lines. Set the start number, the step and a format such as 1. or (1). Turn on Pad with zeros if you want 01, 02 so the numbers line up, and Put number at the end to add it after each line instead.
How do I remove blank lines?
Choose Remove empty. Lines that are empty or hold only spaces and tabs are removed. Turn on Keep one blank line between paragraphs to tidy up gaps without joining every paragraph together.
How do I keep only the lines that contain a word?
Choose Filter, keep lines that contain, and type the word. Separate several words with commas to keep lines that contain any of them. Choose do not contain to remove those lines instead.
Can I reverse the order of lines?
Yes. Choose Reverse and Line order, and the last line comes first. The same tool can also reverse the words in each line or spell each line backwards.
How do I wrap text at 80 characters?
Choose Wrap and set the width to 80 with the slider or the preset button. Lines break at the last space before the limit. Words longer than 80 characters are split only if you leave that option on.
Is my text sent anywhere?
No. Every tool on this page runs in your browser and nothing you paste is uploaded. You can disconnect from the internet after the page loads and it keeps working.