Wrap every line of text with a prefix, suffix, or both. Live output as you type.
Add text before each line (prefix), after each line (suffix), or both — to every line in a list, in one operation. Useful for wrapping items in quotes, generating SQL IN clauses, building command-line argument lists, prepending list bullets, and dozens of other batch-text operations. Everything runs locally in your browser; nothing is uploaded.
You have a list of lines. You want each line to be wrapped with the same text on either side. That's it. The complication is that doing it manually for 50 or 500 lines is mind-numbing, and writing a one-line script every time is overhead. The Prefix & Suffix tool handles the operation in two text fields and a button.
Both prefix and suffix can be any text — letters, numbers, punctuation, special characters, even multi-character strings. They're applied as literal text, not interpreted as regex or templates. If your prefix is ", every line starts with a literal double quote. If your suffix is ",, every line ends with a quote and a comma.
Wrapping a list of strings in quotes. You have 50 product names; you need them as a JSON array. Prefix with ", suffix with ",, then wrap the whole thing in [ and ] — done in 30 seconds instead of 30 minutes.
Generating SQL IN clauses. A list of 500 user IDs that need to feed into WHERE id IN (...). Prefix and suffix each ID with the parentheses, comma, or quote handling you need, then concatenate. Faster than scripting it for one-off queries.
Building command-line argument lists. You have 100 filenames to pass to a CLI tool. Prefix each with --input to produce a list of --input flags. Concatenate into one command, run.
Adding markdown list bullets. Paste a list of items, prefix each with - (hyphen-space) or 1. , get a properly-formatted markdown list. The List bullet/numbering features in word processors are inconsistent across pasting; manual prefix is sometimes more reliable.
Generating import statements. A list of 30 module names that need to become import { name } from './name'; lines. Prefix and suffix produce the boilerplate; manual editing handles the variations.
URL list expansion. A list of slugs needs to become full URLs. Prefix each with https://example.com/ and you're done. Suffix can add query strings or trailing slashes consistently.
Building log filter patterns. A list of error codes that need to become "error_code": "X" filter clauses. Prefix and suffix in pairs.
Creating CSV-quoted text. Surround each line with quotes for CSV embedding, especially when the content might contain commas. (Use suffix to add the trailing comma if you're building a single CSV row from many lines.)
HTML or template tag wrapping. Wrap each line in a <li>...</li> tag for an HTML list. Prefix is <li>, suffix is </li>.
A few prefix/suffix combinations come up so often they're worth memorizing.
JSON string array. Prefix: " Suffix: ", Then manually wrap output with [ and ], and remove the trailing comma from the last line. (Or generate without the trailing comma using a different tool — but in practice, deleting one comma is faster than building dedicated tooling.)
SQL IN with quoted strings. Prefix: ' Suffix: ', Same wrap-and-trim pattern. Use single quotes for SQL strings (most dialects), double quotes for column names (in dialects that require it).
Markdown unordered list. Prefix: - (hyphen, space) Suffix: empty. Three-character prefix; suffix unused.
Markdown numbered list. Prefix: 1. Note: most markdown renderers auto-number when given 1. on every line, so you don't need to increment. Three-character prefix.
HTML list items. Prefix: <li> Suffix: </li>
Comment block (shell, Python, Ruby). Prefix: # Suffix: empty.
Comment block (JavaScript, Java, C, C++). Prefix: // Suffix: empty.
URL prefixing. Prefix: https://example.com/ Suffix: empty (or / if you need trailing slashes).
Empty lines get prefixed too. If your input contains empty lines, those get the prefix and suffix applied — which means an empty line becomes prefix + suffix. Usually not what you want. Run the input through Remove Spaces (with "remove line breaks only" mode at the boundary, or trim) or just delete empty lines first.
Trailing whitespace on input lines. If your input has trailing whitespace, the suffix is appended after the whitespace. Trim first if you want the suffix snug against the content.
Special characters in prefix/suffix. The tool treats both as literal text. Newlines, tabs, and Unicode characters are preserved as-is. If you need a newline inside the prefix (rare but happens), the tool's input field accepts \n as a literal newline escape.
Trailing comma on the last item. The most common gotcha when generating JSON or SQL: the last line has the same suffix as every other line, including its trailing comma. JSON parsers reject trailing commas; SQL parsers do too. Manually delete the last suffix or use a different output format.
This tool — fastest for one-off prefix/suffix on a few hundred lines. No regex syntax to remember.
sed — sed 's/^/prefix/' file.txt prefixes every line. sed 's/$/suffix/' file.txt suffixes. Combine with ; for both. Best for very large files, scripted workflows, and integrations into pipelines.
awk — awk '{print "prefix" $0 "suffix"}' file.txt does both at once. More flexible than sed for conditional prefix/suffix logic.
For one-off use, this tool is fastest. For automation or large files, sed and awk are the right answer.
Paste text into the input box, type your prefix and suffix in the dedicated fields, click Apply. The tool splits the input on line breaks, prepends the prefix and appends the suffix to each line, and joins back with newlines. Empty input fields produce no addition (an empty prefix means no prefix is added, same for suffix).
Performance is O(n) in input size. The tool handles multi-megabyte inputs in well under a second.
Build small, test, build big. If you're generating SQL or JSON for a real query, do the prefix/suffix on three lines first, paste the output into your target tool, confirm it parses, then run the full list. Catching a mistake on three lines is much cheaper than on 500.
Trim before prefixing. The combination is so common it's almost always right. Run input through Remove Spaces (trim mode) before prefixing, or your prefix gets attached to a string that has invisible leading whitespace.
For JSON arrays, build the structure once. Generate the items list with prefix/suffix, then wrap in brackets. Trying to handle the comma logic for "last item has no comma" with this tool requires extra steps; just delete one trailing comma manually after wrapping.
No. Empty lines get the prefix and suffix applied just like any other line. To skip empties, remove them from input first.
The prefix and suffix fields each accept a single line of text. For multi-line wrapping, run the tool twice — first with the inner prefix/suffix, then with the outer.
Not with this tool — it applies prefix and suffix to every line unconditionally. For conditional application, use Find & Replace with a regex pattern, or write a one-line script.
Yes. The prefix and suffix are inserted as literal text. If you need escaped characters in the output (like \" for an escaped quote in JSON), include the backslash in your prefix/suffix string and the tool will preserve it.
No. This tool only adds. To remove a known prefix from every line, use Find & Replace, anchoring with the regex ^prefix.
Practical limit is browser memory. Modern desktop browsers handle several million lines comfortably. Mobile browsers hit limits earlier. For very large files, use sed or awk instead.