Text Cleaner Remove formatting & clean text Lorem Ipsum Generate placeholder text Word Count Count words, chars & reading time
Prefix & Suffix
Presets
0 lines
0 lines
How It Works
  1. 1Type a prefix and/or suffix in the left panel.
  2. 2Or click a preset — double quotes, comma, SQL list, etc.
  3. 3Paste your list in the Input box — result updates live.
  4. 4Click "Copy result" and paste anywhere.

What Is "Add Prefix / Suffix to Each Line"?

This tool prepends a prefix and/or appends a suffix to every line in a block of text. Paste a list, type the characters you want to wrap each line with, and the result updates live on the right — handy for wrapping values in quotes, adding trailing commas for SQL or CSV, prepending a dash for Markdown bullets, or building full URLs from a column of slugs.

How to Add a Prefix or Suffix to Each Line

  1. Paste your text into the left input box — one item per line.
  2. Type a prefix and/or suffix. Use the "Prefix" field to add text before each line and "Suffix" to add text after. Both fields apply at once, so prefix " + suffix " wraps every line in double quotes.
  3. Toggle the options. Turn on "Skip empty lines" so blank lines stay blank (no stray ", from an empty row), and "Trim whitespace" to strip leading and trailing spaces before wrapping.
  4. Copy the result with the "Copy result" button.

Preset Buttons and Their Output

PresetPrefixSuffixInput → Output
Double quotes""apple → "apple"
Single quotes''apple → 'apple'
Comma suffix(none),apple → apple,
Dash prefix- (none)apple → - apple
SQL list'',apple → 'apple',
Parentheses()apple → (apple)
Square brackets[]apple → [apple]

Building a SQL IN() List From a Column

Paste your IDs or string values one per line, click the SQL list preset (single quotes + trailing comma), and enable Skip empty lines so a blank row doesn't leave a stray '',. The output looks like 'apple', on each line — wrap it in IN( ... ) and delete the final comma. For numeric IDs that don't need quoting, leave the prefix empty and use only the comma suffix.

Wrapping Lines in Quotes for a JS or Python Array

To turn a plain list into array literals, set prefix " and suffix ", — each line becomes "value", — then wrap the block in [ ... ] in your editor. For a Python list of strings the same prefix/suffix works; swap to single quotes if your style guide prefers them. Drop the trailing comma on the last element, or leave it (both JS and Python tolerate a trailing comma inside brackets).

Generating HTML or Markdown List Items

For an HTML list, prefix <li> and suffix </li> to convert plain lines into list items, then wrap them in <ul>. For a Markdown bullet list, use the Dash prefix preset (- ) with no suffix. To tag a list of keywords for social posts, set prefix # to turn summer sale into #summer sale (remove spaces first with Find & Replace if you need single-word hashtags).

Prepending Text to Lines Without an Excel Formula

In a spreadsheet you'd normally write ="prefix"&A1 (or =CONCAT("prefix", A1) in Google Sheets) and fill it down a helper column. For a one-off batch, copy the column, paste it here, type the prefix once, and copy the result straight back — no helper column to create and delete. Enable "Trim whitespace" if the pasted cells carry stray spaces.

Related Text Tools

Frequently Asked Questions

How do I add a prefix and suffix on both sides at once?

Fill in both fields — the tool applies them together. To wrap each line in double quotes with a trailing comma (for a JS array or SQL list), set prefix " and suffix ",. The order is always prefix + line + suffix.

How do I avoid a stray comma on blank lines when building a SQL list?

Enable "Skip empty lines". Without it, a blank row in your input becomes '', in the output, which breaks an IN() clause. With it on, empty lines pass through untouched so your list stays clean.

What's the difference between "Skip empty lines" and "Trim whitespace"?

"Skip empty lines" leaves rows that are already blank untouched instead of wrapping them. "Trim whitespace" removes leading and trailing spaces from each line before the prefix and suffix are added — useful when pasted spreadsheet cells carry hidden padding that would otherwise sit inside your quotes.

Can I prepend a base URL to a list of slugs?

Yes. Put https://example.com/ in the Prefix field and paste your slugs one per line — each becomes a full URL. Leave the suffix empty, or add a trailing slash there if your paths need one.