Add prefix and suffix to lines
Add text to the start and end of each line at once – commas, quotes, SQL values or HTML list items, with one-click presets.
Your text is processed in your browser and never sent to our server.
0 characters · 0 words · 0 lines
How to add text to each line
This tool adds a prefix (text at the start) and/or a suffix (text at the end) to every line of your text at once. The result updates as you type.
- Paste your list into the input box, open a .txt file or drop it on the box.
- Type the text you want at the start of each line into Add to start and the text for the end into Add to end. Leave a field empty if you only need one of them.
- Or click a quick preset, for example comma at end or SQL list.
- Click Copy result or download the result as a .txt file.
What the options do
- Quick presets fill both fields for common jobs: a comma after each line, single or double quotes around each line, SQL values like
('x'),and HTML list items<li>x</li>. - Skip empty lines leaves blank lines as they are, so you do not end up with lonely commas or empty quotes.
- Trim spaces first removes spaces and tabs around each line before adding text – handy for lists copied from a PDF or a web page.
- No comma on the last line drops the trailing comma or semicolon of the suffix on the last line, which is what you need for an SQL
IN (…)list, a JSON array or a function argument list.
Examples
Add a comma at the end of each line (suffix ,, "No comma on the last line" on):
apple → apple, banana → banana, cherry → cherry
Wrap each line in quotes for an SQL query (preset quotes 'x', then add commas with the separator converter if needed):
SK123 → 'SK123' CZ456 → 'CZ456'
Turn lines into an HTML list (preset HTML <li>x</li>):
Home → <li>Home</li> About → <li>About</li>
Frequently asked questions
How do I add a comma at the end of each line?
Paste the lines, click the comma at end preset and copy the result. Turn on No comma on the last line if the list goes into code or SQL. If you need everything on one line separated by commas, use the separator converter instead.
How do I add a prefix to each line in Excel or Google Sheets?
Use a formula in a helper column: ="prefix"&A1&"suffix" (works in both), then fill it down and copy the values. With this tool you skip the helper column: paste the column here, add the text and paste the result back.
Can I add text only to the start or only to the end?
Yes. Leave the other field empty. Spaces count, so type - with a trailing space if you want a space after the prefix.
Is my data safe?
Yes. All processing happens locally in your browser with JavaScript. Your text is never sent to our server.
Can I number the lines instead?
For numbers use add line numbers, and to sort the list first try sort lines.