About the Add Prefix & Suffix to Lines tool
Adding the same text to the start or end of many lines is a surprisingly common chore. You might need a URL in front of every product slug, “.jpg” after every file name, quotes and a comma around each value for code, or HTML tags around every list item. Doing it by hand is slow, and spreadsheet formulas are overkill for a quick job.
Paste your lines, type a prefix, a suffix or both, and every line is updated instantly. One-click presets cover the frequent cases: quoted values with a trailing comma, bullet points, HTML <li> tags, Markdown checkboxes, SQL value tuples, and exact or phrase match brackets for keyword lists in ad platforms. Use {n} anywhere in the prefix or suffix to insert a running line number, so “img-{n}.jpg” produces img-1.jpg, img-2.jpg and so on.
“Skip empty lines” leaves blank lines untouched so paragraphs stay separated, and “Trim each line first” removes stray spaces before the new text is added. The work happens in your browser, and the result can be copied or downloaded as a text file.
How to use Add Prefix & Suffix to Lines
- Paste one item per line into “Lines of text”, or click “Sample”.
- Type text into “Prefix (added before each line)” and/or “Suffix (added after each line)”, or click a preset.
- Include {n} in either field if you want line numbers.
- Choose “Skip empty lines” and “Trim each line first”.
- Copy the result or download it.
Features
Prefix and suffix together
Add text to both ends of every line in one pass.
Seven presets
Quotes, bullets, <li> tags, Markdown tasks, SQL tuples and keyword match types.
Line number placeholder
{n} inserts a counter that skips blank lines when they are skipped.
Whitespace control
Trim each line before adding text to avoid double spaces.
Monospace output
Easy to scan when preparing code or data.
When to use it
- Turn a list of slugs into full URLs by adding https://example.com/ in front.
- Wrap keywords in [brackets] or "quotes" for exact and phrase match in Google Ads.
- Convert a list into HTML list items for a web page.
- Prepare values for an SQL INSERT or a JavaScript array.
- Add a file extension to a list of image names.
Frequently asked questions
How do I add text to the beginning of every line?
Type it into the Prefix box. It appears before each line of your input immediately. Leave the Suffix box empty if you only need a prefix.
Can I add a comma to the end of each line?
Yes. Type a comma in the Suffix box. The “Quotes "…",” preset also adds quotes around each line with a comma after it.
How do I number the lines at the same time?
Put {n} in the prefix or suffix, for example “{n}. ” as the prefix. For more numbering formats use the Add Line Numbers tool.
What happens to blank lines?
With “Skip empty lines” on they are left blank. Turn it off to add the prefix and suffix to empty lines too.