Prefix and Suffix Tool — add text to every line

Paste a list, type a prefix and a suffix, and the tool wraps every line for you. It is the kind of micro-tool you reach for two or three times a week once you know it exists: turning a column of IDs into a SQL IN clause, prepending https:// to a list of domains, wrapping filenames in quotes for a shell command.

Open the Prefix / Suffix tool

What it does

The Prefix and Suffix tool reads your input one line at a time. For each non-empty line, it prepends the prefix string and appends the suffix string, then writes the result to the output panel. That is the entire operation. The value comes from how often this transformation shows up in everyday work and how awkward it is to do by hand once a list grows past a dozen rows.

Both fields accept any text, including special characters and whitespace. If you want a trailing comma after every row, type a comma in the suffix box. If you want each row wrapped in single quotes, put ' in both the prefix and suffix.

Who it's for

When to use it

Concrete situations where this small tool replaces a much larger workflow:

Features

  • Live preview. The output updates as you type the prefix, the suffix, or new input. No need to click a button to see the result.
  • Per-line application. Each line is treated independently. Order is preserved; nothing else is touched.
  • Optional: ignore empty lines. By default, blank lines pass through untouched. You can toggle a strict mode that either drops them or wraps them too, depending on what your downstream tool expects.
  • Optional: trim whitespace. If your input has trailing spaces (a common artefact of copy-paste from spreadsheets), the tool can strip them before wrapping.
  • Optional: remove duplicates. Useful when you are building an IN clause and want to be sure the query planner sees only distinct values.
  • One-click copy and download. Send the result straight to the clipboard or save it as a text file.
  • No upload. The transformation runs entirely in your browser. The text never leaves your machine.

How it works

Internally the tool is a few lines of JavaScript. It splits the input on newline characters (\n or \r\n), iterates over the resulting array, and for each entry concatenates prefix + line + suffix before joining the array back with \n. The optional toggles add a trim step, a uniqueness filter, and a skip-if-empty condition before the wrap.

That is intentionally simple. The point of the tool is not to be clever, but to remove the friction of either writing the same one-liner by hand each time or reaching for a heavier text editor with a macro recorded six months ago that nobody else on the team can use.

Real workflows

Turning 1,000 user IDs into a SQL VALUES list

You have a CSV column of integer IDs in a Google Sheet. You need to INSERT them into a staging table.

  1. Copy the column from the sheet.
  2. Paste into the Prefix and Suffix tool.
  3. Set prefix to (, suffix to ),.
  4. Copy the result. Wrap the whole block in INSERT INTO staging (user_id) VALUES ... ;, removing the trailing comma from the last row.

For an IN clause the prefix is empty and the suffix is , (or wrap each value in quotes if the column is a string).

Prepending https:// to a domain list from CSV

A marketing colleague exports a list of 300 advertiser domains as a one-column CSV. You need full URLs for a crawl.

  1. Open the CSV in any text editor, copy the lines.
  2. Paste into the tool, set prefix to https://, suffix empty.
  3. If some entries already include the scheme, run a quick find-and-replace in your editor before pasting, or use the upcoming "skip if prefix already present" option.

Wrapping every line in quotes for a JSON array

Set prefix to ", suffix to ",. Then wrap the whole output in [ ... ] and delete the last comma. The result is a valid JSON string array of your inputs — useful when constructing a request body in an API client.

Generating per-line shell commands

You have a list of files to delete after a migration. Prefix with rm -f /var/log/old/, leave the suffix empty, and the output is a series of safe rm commands you can paste into a shell or save as a script. (Always inspect before running, especially with destructive commands.)

FAQ

Can I add different prefixes to different lines?

Not in a single pass — that is what spreadsheets and small scripts are for. The tool's value is in doing one transformation extremely well. If you need conditional logic, use a text editor with regex or a five-line Python script.

Does the tool handle very large inputs?

Tens of thousands of lines are fine — the underlying operation is linear, and modern browsers can string-join a few megabytes of text in milliseconds. If you are working with hundreds of megabytes, stream-processing on the command line will be a better fit than any browser-based tool.

What about line endings?

The tool accepts both Unix (\n) and Windows (\r\n) line endings on input and normalises to Unix newlines on output. If you need Windows-style output, paste the result into an editor that lets you save with CRLF, or use a follow-up tool.

Is anything sent to the server?

No. The transformation runs in your browser. The tool makes no network calls beyond the page itself and standard analytics. See the privacy page for the full rundown.


Related tools

Related reading