Skip to content

Add Prefix & Suffix to Lines

Paste a list with one item per line, type what should go before and after each one, and press Apply. Presets handle the common jobs: double quotes, a trailing comma, a Markdown bullet and 1. 2. 3. numbering. Free, no sign-up, and the text stays in your browser.

0 lines

Presets

How to Use the Prefix and Suffix Tool

  1. Paste one item per line. Each line is treated separately.
  2. Fill in the prefix, the suffix, or both. The prefix goes at the start of every line and the suffix at the end. Spaces you type count, so "- " with a trailing space puts a space after the dash.
  3. Set the two options. Skip empty lines is on by default, and Number lines (1., 2., 3., …) is off. Or press a preset, which fills the fields for you.
  4. Press Apply, then copy. The result does not update as you type, so press Apply again after you change a field. Three counts show input lines, output lines and output characters.

Recipes You Can Copy

Each row below shows what to type and what "apple" comes out as. The fields take any text, so these are starting points rather than a fixed list.

JobPrefixSuffix"apple" becomes
Quote strings for code"","apple",
Markdown bullet- - apple
HTML list item<li></li><li>apple</li>
Link from a list of page nameshttps://example.com/https://example.com/apple
SQL string list'','apple',
Numbered list(Number lines)1. apple

With the quote-and-comma recipe, the three lines "apple", "banana" and "cherry", with a blank line between the second and third, come out as the following. The blank line is left alone because Skip empty lines is on, and with Number lines ticked the counter skips it too, so cherry is 3, not 4.

Quote + comma

"apple",\n"banana",\n\n"cherry",

Number lines

1. apple\n2. banana\n\n3. cherry

Limits to Know About

  • The last line gets the suffix too. A comma suffix leaves a trailing comma after the final item, which code lists and SQL do not accept. Delete it by hand, or use the Comma Separator, which joins lines into one string with no trailing comma.
  • Quotes inside a line are not escaped. A line that already contains a double quote comes out with unbalanced quotes. Escape them first with Find and Replace.
  • Numbers come before the prefix. With numbering on and the prefix "- ", a line becomes "1. - apple". Use one or the other.
  • A line holding only spaces counts as empty when Skip empty lines is on, and is passed through unchanged. Turn it off to give blank lines a prefix and suffix as well.

Which Tool Do You Need?

If you want…Use
Text added around every lineThis Prefix and Suffix tool
Bullet symbols, arrows or checkmarks, with indented sub-itemsBullet Point Generator
Lines joined into one comma-separated string, or back againComma Separator
A start number, zero-padding or a custom separator on line numbersAdd Line Numbers
Text replaced inside lines rather than added to themFind and Replace

Frequently Asked Questions

How do I add text to the beginning of every line?
Paste your lines, type the text into the prefix field and press Apply. It is placed in front of every line at once. Use the suffix field in the same way for the end of each line, or fill both to wrap each line.
How do I put quotes around every line?
Press the Wrap in "double quotes" preset, or type a double quote in both the prefix and suffix fields. Add a comma to the suffix as well (a quote followed by a comma) if the list is going into an array or an SQL IN clause, and remove the comma after the last item.
What does Skip empty lines do?
With it ticked, a blank line passes through unchanged instead of receiving the prefix and suffix, so the gaps between groups of lines are preserved. With it off, every blank line becomes a line containing just the prefix and suffix.
Can I make a Markdown list with it?
Yes. The Markdown list preset sets the prefix to a dash and a space, which is a valid Markdown bullet. Press the Number lines preset for 1. 2. 3. instead; Markdown also accepts a number followed by a full stop as an ordered-list marker.
How is this different from the Bullet Point Generator?
This tool adds whatever text you type to every line. The Bullet Point Generator picks a symbol such as •, ✓ or → for you and can indent sub-items. Use this one for quotes, tags, URLs and code; use the other for lists meant to be read.
Is my text uploaded or stored?
No. The text is formatted in your browser and nothing is sent to a server. Closing the tab clears it.

Related Tools

More in Text Cleanup & Formatting

See all Text Cleanup & Formatting