About Add Prefix and Suffix to Lines
This FreeToolr tool adds the same prefix and suffix to each line you paste or type. You can include {n} in either box to insert the line number; numbering counts only the lines that actually change. Use the Skip empty lines toggle to leave empty lines alone. Use the Trim spaces toggle to remove leading and trailing spaces from each line before the prefix and suffix are applied. Everything runs in your browser; the site does not upload your text to a server. Results update instantly as you type and show a live count of Lines changed. You can copy the output or create a share link that reopens with your numbers. Typical users include developers, content editors, list-builders, and anyone making CSV, SQL or quoted lists.
How to use it
- 1Paste your text into the Lines box.
- 2Enter a Prefix and a Suffix. Use {n} for line numbers.
- 3Toggle Skip empty lines and Trim spaces if needed.
- 4Copy the Result or create a share link.
Worked example
Input lines: apple banana cherry pie Settings: Prefix: Q{n}= Suffix: ; Skip empty lines: Yes Trim spaces: Yes Result: Q1=apple; Q2=banana; Q3=cherry pie;
How it works
Each line gets the prefix in front and the suffix after it{n} in either box becomes the line number, counting only the lines that were changedEmpty lines are left alone when Skip empty lines is onResults update instantly as the visitor types; there is no calculate buttonVisitors can copy the result and share a link that reopens with their numbersSource: RFC 4180 - Common CSV Format (IETF)PostgreSQL: SQL Syntax and Lexical StructureEU GDPR guidance - European Commission. Last checked 6 November 2026.
What it is good for
- Instant in-browser results with no upload.
- Supports {n} for live line numbers and shows lines changed.
- Skip-empty and trim options keep your layout intact.
- It does not remove an existing prefix or suffix; use a separate remove/replace tool for that.
Questions people ask
Will my text be uploaded to a server?
No. The transformation runs in your browser after the page loads. If you paste personal data, consider local laws before sharing, but the tool itself does not send your text to a server.
How does {n} numbering work?
{n} becomes the line number for lines that are changed. If Skip empty lines is on, empty lines do not count and numbering skips them. For example, the third changed line shows {n}=3.
Can I leave blank lines unchanged?
Yes. Turn on Skip empty lines to leave empty lines exactly as they are. If you turn that off, the tool adds prefix and suffix to every line, including blank ones after trimming.
How do I avoid adding a prefix twice?
This tool does not have a built-in "do not add if already there" mode. To avoid double-wrapping, remove the old prefix first using a find-and-replace or a remove-prefix tool, then add the new wrapper.
Will this handle CSV or SQL quoting correctly?
The tool wraps text as you request. For CSV use RFC 4180 rules and for SQL follow your database's string rules, for example PostgreSQL's quoting. Escape embedded quotes before wrapping if your target format requires it.
Does it support right-to-left languages and Unicode?
Yes. The editor preserves Unicode and basic text direction from your clipboard. Check your target app for display and import behavior, and prefer UTF-8 when saving files.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.