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.
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
- Data analysts who routinely paste a column of IDs from a spreadsheet into a SQL query.
- DevOps and SREs generating one-off shell commands from a list of hostnames, container IDs, or log files.
- Ad-tech operators turning a list of placement IDs or domain names into a quoted JSON array.
- Anyone who works with lists — engineers, support reps, marketers preparing Slack-friendly bulleted output, students formatting bibliography entries. The tool is general enough to apply almost anywhere line-by-line transformation is needed.
When to use it
Concrete situations where this small tool replaces a much larger workflow:
- Preparing data for SQL
INorNOT INclauses. You have 600 user IDs in a spreadsheet column. Copy the column, paste it in, set prefix to'and suffix to',, and you have a comma-separated quoted list ready to drop between parentheses. - Building HTML or Markdown lists. Set prefix to
<li>and suffix to</li>to wrap each line in a list item. For Markdown, prefix with-and leave the suffix empty. - Formatting Slack or email messages. Turn a column of bullet points into a properly indented list before pasting it into a channel.
- Batch URL preparation. Add
https://in front of a list of bare domains, or wrap each URL in<url>...</url>tags for a sitemap. - Generating shell commands. Have a list of container IDs? Set prefix to
docker stopand you have a ready-to-paste series of commands. - Building JSON arrays of strings. Combined with newline-to-comma post-processing, the tool turns plain lists into
["a", "b", "c"]very quickly. - Renaming files in a script. Prepare a
mv old/{name}.txt new/{name}.bakline for every file in a directory listing.
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
INclause 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.
- Copy the column from the sheet.
- Paste into the Prefix and Suffix tool.
- Set prefix to
(, suffix to),. - 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.
- Open the CSV in any text editor, copy the lines.
- Paste into the tool, set prefix to
https://, suffix empty. - 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
- Escape and unescape — wrap-then-escape combinations are common when preparing SQL or JSON literals.
- JSON to CSV converter — turn structured data into row-per-line output that pairs naturally with this tool.
- Text diff — verify your wrapped output against an expected list.