What is the Prefix & Suffix Adder?
The prefix and suffix adder appends text to the beginning (prefix) or end (suffix) of every line in a block of text simultaneously. Instead of manually editing each line, you type the prefix and suffix once and the tool instantly applies it to every line. This is essential for bulk text transformation tasks in development, content editing, and data processing.
How to Use the Prefix & Suffix Adder
Paste your text into the input box. Type a prefix, a suffix, or both. The output updates live as you type โ no button click needed. Use "Skip empty lines" to leave blank lines unchanged, and "Trim whitespace" to clean up lines before processing. Click Copy Output to grab the result.
Common Use Cases
- Markdown lists: Add
-as prefix to convert plain text lines into markdown list items - HTML wrapping: Add
<li>as prefix and</li>as suffix to convert text into HTML list items - SQL IN clauses: Add
'as prefix and',as suffix to format values for SQL queries - Quoted arrays: Add
"as both prefix and suffix to wrap each line in double quotes - CSV prefix: Add a common domain or path prefix to a list of slugs or filenames
- Comment markers: Add
//as prefix to comment out every line in code - Numbered prefix: Add a fixed label like
Item:to structure a plain list
How It Works
The tool splits your input on newline characters, processes each line independently (optionally trimming whitespace and skipping empty lines), then prepends the prefix and appends the suffix to each line. The result is joined with newlines and shown in the output panel. This matches the behavior of the Unix sed command s/^/prefix/; s/$/suffix/ โ a classic text processing pattern in use since 1971.
Frequently Asked Questions
What is a prefix and what is a suffix?
Prefix = text added to the start of every line. Suffix = text added to the end of every line. Both can be used together: prefix <li> + suffix </li> โ <li>each line</li>.
What can I use this for?
Adding markdown list markers (- ), HTML tags, SQL quote formatting, JSON array formatting, comment markers, URL path prefixes, file extension suffixes, and any repetitive line-by-line text transformation.
What does Skip empty lines do?
Empty lines pass through unchanged โ no prefix or suffix is added to blank lines. Useful for preserving paragraph breaks.
What does Trim whitespace do?
Removes leading and trailing spaces from each line before adding the prefix/suffix. Useful for cleaning up indented or inconsistently padded input.
How do I add quotes around each line?
Set prefix = " and suffix = ". Each line becomes "line content". Use single quotes for JavaScript string arrays.
How do I wrap lines in HTML tags?
Prefix = <li>, suffix = </li>. Result: <li>content</li> on every line.
Can I use this for SQL IN clauses?
Yes: prefix = ', suffix = ',. Each value becomes 'value',. Remove the trailing comma on the last line manually, or use a text editor macro.
Is my text data private?
Yes. Processing runs entirely in your browser. Nothing is sent to any server.