What this tool does

Add Prefix & Suffix takes a list of lines and prepends a string to the start and/or appends a string to the end of every line. It's the simplest text-transformation tool on the site, and one of the most useful, almost every "wrap each item in X" job is one prefix and one suffix away.

Type your text into the input editor, drop a value into the Prefix and/or Suffix fields, and watch the output update on every keystroke. Toggle Skip empty lines to leave blank lines untouched (default: on, because adding <li></li> to an empty line is rarely what you want).

How to use it

1. Paste your list, one item per line. 2. Type into the Prefix field whatever should appear at the start of each line. 3. Type into the Suffix field whatever should appear at the end of each line. 4. Copy the output, or hit Download for a .txt file.

That's the whole tool. The status line below the editors shows how many lines were modified, the total output size, and how long the run took (essentially zero, the operation is a single split + map + join).

Things people use this for

Most "I need to bulk-format this list" tasks reduce to one prefix and one suffix. A few common ones:

  • HTML list items, prefix <li>, suffix </li>. Then wrap the whole output in <ul>…</ul>.
  • SQL IN () clauses, prefix ', suffix ',. Drop the trailing comma manually.
  • Markdown bullet lists, prefix - , suffix nothing.
  • Markdown numbered lists, prefix 1. (Markdown auto-renumbers, so every line can literally be 1.).
  • YAML array items, prefix - , suffix nothing.
  • JSON string array, prefix ", suffix ",. Then wrap with […] and remove the final comma.
  • CSV column wrapping, prefix ", suffix ". Combine with a separator pass for full quoting.
  • Shell commands per line, prefix curl -X POST , suffix && echo done.
  • Python list literals, prefix ", suffix ",. Indent + quote in one pass.
  • Comment every line, prefix // or # to disable a block of code without manually visiting each line.

Skip empty lines, and why it's the default

Lots of pasted lists have stray blank lines between groups. Without the skip, those blanks become <li></li> or - , visible empty bullets that you'd have to clean up afterwards. Skip empty lines means a line consisting only of whitespace is passed through unchanged, preserving the visual grouping in the output. Turn the toggle off if you actually want to wrap whitespace-only lines (rare, but valid for fixed-width formatting).

What this tool deliberately does not do

  • Per-line transformations beyond prefix/suffix. If you need to also lowercase, trim, or substring each line, run the output through Case Converter or Find & Replace first.
  • Counter substitution. This tool doesn't expand {i} to a 1-based line number. For numbered lists in plain text, paste the output into a tool that handles numbering, or use Markdown's auto-renumbering.
  • Conditional prefixes. Every non-skipped line gets the same prefix and suffix. If you need "prefix X for lines starting with foo, prefix Y otherwise", that's a Find & Replace job, not a prefix/suffix job.

Common gotchas

  • Trailing comma in arrays. When you build a JSON or SQL array by adding a , suffix, the last line will also end with a comma. Strict JSON parsers reject trailing commas; SQL doesn't care. Manually remove the last comma, or add it as a separator instead.
  • Escaping inside the prefix/suffix. The fields take literal characters, not regex or template syntax. A literal \n in the suffix appears as the two characters backslash-n, not a newline.
  • Tab characters. Pasting a tab into the prefix field works, tab-separated output is fine. But many browsers map Tab to the next focusable element instead of inserting a literal tab. Copy a tab from your editor instead.
  • Very long inputs. The tool handles tens of thousands of lines easily; the bottleneck is the browser textarea's render performance, not the transformation.

Privacy

The input, the prefix and suffix you type, and the output all stay in your browser. Nothing is uploaded to any server. Recent inputs are saved in your browser's local storage and can be cleared from the "Recent" card.

Frequently asked

Can I leave one of the fields empty?

Yes. Leave Prefix empty to only append a suffix, or leave Suffix empty to only prepend a prefix. Leaving both empty produces output identical to the input (minus any trim that empty-line skipping does). Most real jobs use only one of the two.

What does 'Skip empty lines' actually skip?

Lines that contain only whitespace (or nothing at all). Those lines pass through to the output unchanged, so visual grouping in your input is preserved. With the toggle off, even a blank line gets the prefix and suffix glued to it, which is rarely what you want for HTML or Markdown output.

How do I number my list?

This tool doesn't substitute counters. For Markdown, prefix '1. ' on every line — Markdown renumbers automatically when rendered. For plain text, generate the numbers separately (a quick spreadsheet column) and paste the combined result, or use a dedicated 'add line numbers' tool.

How do I quote each line for a SQL IN clause?

Set Prefix to a single quote and Suffix to a single quote followed by a comma. The output will be a comma-separated list of quoted strings — manually delete the final trailing comma before the closing parenthesis, or use this tool to create the body and wrap with '(' ')' yourself.

Can I use the prefix/suffix to add a newline?

The fields don't interpret escape sequences — typing '\n' inserts the two characters backslash-n, not a newline. To add an extra newline at the end of every line, you'd need a different tool (e.g. find-and-replace 'end of line' with two newlines).

Does the tool change anything inside each line?

No. Only the start and end of each line are touched. The original line content is preserved byte-for-byte between the prefix and suffix. If you need to modify the middle of each line, run the output through Find & Replace or a regex tool.

How big a list can I process?

Tens of thousands of lines run comfortably — the operation is a single split / map / join pass that takes milliseconds. The browser's textarea rendering is the practical limit; if your list is so large that the editor stutters, consider processing it in a script instead.

Is my data sent to a server?

No. The transformation runs entirely in your browser. The input, the prefix/suffix you type, and the output never leave the device. Recent inputs are stored in your browser's localStorage so you can replay them, and you can clear them from the Recent card.