Add Prefix / Suffix
Add a prefix or suffix to every line.
How to Use Add Prefix / Suffix
- 1Paste your multi-line text
- 2Enter your desired prefix and/or suffix
- 3Click the apply button
- 4Copy or download the result
About Add Prefix / Suffix
Add Prefix & Suffix lets you prepend and/or append any custom text to every line of your input simultaneously. This is extremely useful for bulk line formatting operations: adding quote marks around each item, wrapping lines in HTML tags, adding commas at the end of every line for array literals, numbering list items, or generating SQL INSERT value strings.
You can add just a prefix, just a suffix, or both at the same time — the tool applies whichever fields you fill in. Empty lines are skipped by default to keep output clean, and the transformation is applied instantly as you type in the prefix or suffix fields.
Processing runs entirely in your browser with no server required. This tool saves significant time compared to manually editing each line in a list, especially when working with large data sets or repetitive formatting tasks.
Key Features of Add Prefix / Suffix
- Add a custom prefix to the start of every non-empty line
- Add a custom suffix to the end of every non-empty line
- Apply prefix only, suffix only, or both simultaneously
- Skips empty lines to keep output clean
- Instant real-time application as you type in the prefix/suffix fields
- One-click copy button for the formatted output
- Download result as a plain .txt file
- Runs entirely in-browser with no data transmission
Examples
Add commas to each line for a JavaScript array literal
Wrap a list of items with quotes and trailing commas to create array literal values.
Input
apple banana cherry
Output
"apple", "banana", "cherry",
Wrap each line in an HTML list item tag
Convert a plain list into HTML <li> elements for a web page.
Input
First item Second item Third item
Output
<li>First item</li> <li>Second item</li> <li>Third item</li>
Common Use Cases
- Wrapping list items in HTML tags for direct copy-paste into a webpage
- Adding quote marks and commas to lines for JavaScript or Python array literals
- Generating SQL INSERT value rows by adding "INSERT INTO table VALUES (" prefix
- Adding a common URL prefix to a list of relative paths
- Numbering lines by adding a sequence prefix to each item
- Appending file extensions to a list of base filenames in bulk
Troubleshooting
Prefix or suffix being applied to blank lines
Solution
Empty lines are skipped by default — prefix and suffix are only applied to lines with content. If blank lines appear in the output with prefix/suffix applied, they were not actually empty (they may contain spaces).
Trailing newline creating an extra blank line in the output
Solution
If your input ends with a newline (a blank final line), the output may have a trailing blank line. Use the Remove Empty Lines tool after applying prefix/suffix to clean up any trailing blank lines.
Wanting to apply different prefixes to different lines
Solution
This tool applies the same prefix and suffix to every non-empty line. For different prefixes per line, use the Find & Replace tool with a regex pattern, or process subsets of your text separately.
Frequently Asked Questions
Does it apply prefix and suffix to empty lines?
No. Prefix and suffix are only added to lines that contain at least one character. Blank lines (completely empty or whitespace-only) are skipped and appear unchanged in the output.
Can I add both a prefix and a suffix at the same time?
Yes. Fill in both the prefix and suffix fields, and both will be applied to each line simultaneously. You can also use just one field and leave the other empty.
Can I add HTML tags as prefix and suffix?
Yes. Type any text including HTML tags in the prefix and suffix fields. For example, prefix "<li>" and suffix "</li>" will wrap each line in HTML list item tags.
Can I include spaces or special characters in the prefix/suffix?
Yes. The prefix and suffix fields accept any characters including spaces, tabs, quotes, angle brackets, and other special characters. Whatever you type is inserted verbatim.
What if I want to add a line number as a prefix?
This tool inserts a fixed text prefix for all lines. Dynamic prefixes like sequential line numbers require a scripting approach. Use a programming language or a more advanced text editor macro for numbered prefixes.
Is there a line count limit?
No. The tool processes text of any length locally in your browser. Lists with thousands of lines are formatted instantly.
Is my text stored or sent to a server?
No. All processing runs in client-side JavaScript. Your text is never uploaded, stored, or transmitted to any server.
Can I use this to generate SQL INSERT statements?
Yes. For example, if each line is a set of values like "1, 'Alice', 30", add the prefix "INSERT INTO users VALUES (" and the suffix ");" to generate a SQL statement for each line. This is a fast way to convert spreadsheet rows into SQL.