Add Prefix and Suffix to Each Line - Free Online Tool

Add text to the beginning and end of every line at once. Perfect for wrapping lists in quotes, adding bullet markers, or building code from plain text. Free and browser-based.

Add a Prefix or Suffix to Every Line at Once

This tool adds a prefix, a suffix, or both to every line of your text in one pass. Type your list, enter the text to prepend and append, and the result updates live as you type. The processing happens entirely in your browser, so your data never leaves your machine and there is nothing to install or sign up for.

Developers wrap lists of values in quotes and commas to build arrays, SQL IN clauses, or JSON fragments from plain columns. Marketers turn keyword lists into hashtag sets by prefixing every line with a hash sign. Spreadsheet users add units, currency symbols, or HTML tags around hundreds of cells worth of data in seconds instead of editing each row by hand.

The tool splits your input on line breaks, then concatenates prefix plus line plus suffix for each row and joins everything back together. Because it is plain string concatenation, any characters work: quotes, brackets, tabs pasted from a spreadsheet, emoji, or full HTML tags such as list item markers for quickly building markup from content. No escaping or special syntax is ever required.

The skip empty lines option leaves blank lines untouched, which keeps paragraph breaks clean when your list has visual groupings. A common pattern is wrapping 200 product IDs in single quotes with a trailing comma, a job that takes under five seconds here versus ten minutes of manual editing or writing a throwaway script. The live preview means mistakes are visible immediately, before anything is copied out.

Pair this tool with Sort Lines to alphabetize your list before wrapping it, or with Remove Duplicate Lines to weed out repeated entries so your generated code or markup is clean from the start. A typical workflow pastes an exported column, deduplicates it, sorts it, and then wraps every line in quotes here, producing import-ready code in under a minute without opening a spreadsheet or writing a script.

How the Prefix & Suffix Tool Works

  1. 01Paste your list into the input box with one item per line.
  2. 02Type the prefix to add before each line, the suffix to add after it, or both.
  3. 03Watch the live preview update as you type; empty lines can be skipped.
  4. 04Copy the wrapped result and paste it into your code, document, or spreadsheet.

Wrapping Lines Like a Power User

The classic use of this tool is turning a plain column of values into code. To build a quoted, comma separated list for a SQL IN clause or a JavaScript array, set the prefix to a single quote and the suffix to a quote followed by a comma. Paste 300 product IDs, copy the result, and delete the one trailing comma at the end. For HTML, wrap lines in list item tags by using an opening tag as prefix and a closing tag as suffix. Markdown users can create instant bullet lists with a dash and a space as the prefix. Social media managers turn keyword lists into hashtags by prefixing a hash sign with no suffix at all. The tool applies plain text concatenation, which means every character you type is used literally, including spaces, so pay attention to whether your prefix should end with a space. The skip empty lines option is on by default because most lists use blank lines as visual grouping, and wrapping an empty line would produce just the prefix and suffix stuck together. If you need different transformations on different lines, run the tool in batches.

When to Use Prefix & Suffix

Use this tool whenever the same text needs to be added to many lines: preparing arrays and SQL lists from exported columns, converting plain lists to Markdown or HTML markup, adding hashtags for social posts, appending units or currency codes to numbers, or building test data. It replaces the tedious cycle of manual editing or writing a one-off script. If you only need to change some occurrences rather than every line, a find and replace operation is the better fit.

Common Use Cases

  • Wrap exported IDs in quotes and commas for a SQL IN clause or JSON array.
  • Turn a keyword list into hashtags by prefixing every line with a hash sign.
  • Convert a plain list into HTML list items with opening and closing tags.
  • Sort your list alphabetically before wrapping it for cleaner code. Sort Lines Alphabetically - Free & Private

Expert Tips

  • Deduplicate your list first so the generated code does not contain repeated entries.
  • For CSV building, use a suffix of a comma and then remove only the last one after copying.
  • Combine a tab prefix with pasting into a spreadsheet to indent all lines one column.

Frequently Asked Questions

Can I add only a prefix or only a suffix?
Yes. Leave either field empty and only the filled one is applied. A prefix alone is perfect for bullets and hashtags, a suffix alone for trailing commas.
Are spaces in the prefix preserved?
Yes, every character is used exactly as typed, including leading and trailing spaces. If your bullet needs a space after the dash, include it in the prefix field.
How do I build a comma separated quoted list?
Set the prefix to a quote character and the suffix to a quote plus comma. Copy the result and remove the final trailing comma, or paste as is where trailing commas are allowed.

Related tools

12 suggested