Text Tools
Add Prefix and Suffix to Every Line
Add text to the start and end of every line, number lines with {n}, then join the results with commas, semicolons or spaces, e.g. for a quoted SQL list.
How to use Add Prefix and Suffix to Every Line
Paste one item per line, type a prefix and suffix, and the result updates as you type. Choose how the lines are joined, and use {n} for a line number, \t for a tab and \n for a new line inside the prefix or suffix.
- Paste the linesPaste IDs, keywords, file names or values, one per line.
- Type prefix and suffixE.g. a single quote on both sides for SQL, a hyphen and space for a bullet list, or {n}. for numbering.
- Choose the joinerKeep new lines, or join with comma and space, comma, semicolon, space or nothing.
Common uses with examples
With the default single-quote prefix and suffix and Join results with set to Comma and space, the lines apple, banana and cherry become 'apple', 'banana', 'cherry', ready for an SQL IN (...) clause. Use a double quote on both sides with Comma for the inside of a JSON or JavaScript array. A prefix of {n}. followed by a space numbers the lines 1. apple, 2. banana, 3. cherry. Wrapping each line in list-item tags builds the items of an HTML list, and a prefix such as https://example.com/ turns page slugs into full URLs.
Blank lines, spaces and special characters
Each line is trimmed first by default, so stray spaces do not end up inside the quotes. Blank lines are skipped and do not use up a number; when joining with new lines they stay in place as empty lines, otherwise they disappear. Choose Add prefix and suffix too under Blank lines if empty items should be wrapped as well. In the prefix and suffix, {n} is replaced by the running number, \t by a tab and \n by a new line, so a suffix of \n with New lines as the joiner leaves an empty line after every item.
Accuracy and data handling
Before copying the output, check names, punctuation and the intended meaning against the source text. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How do I add text to the beginning of every line?
Type it in Prefix and leave Suffix empty. Every non-blank line gets the prefix, and the result updates as you type.
How do I turn a list into a quoted, comma-separated list?
Set Prefix and Suffix to a single or double quote and Join results with to Comma and space. apple, banana and cherry on separate lines become 'apple', 'banana', 'cherry'.
Can I number each line?
Yes. Put {n} in the prefix or suffix, e.g. {n}. followed by a space. Only lines that get a prefix are counted, so blank lines are not numbered.
Are blank lines given a prefix?
Not by default; they are skipped. Choose Add prefix and suffix too under Blank lines to wrap them as well.
More Text Tools
Related toolsReplace words or patterns in text, with regex and whole-word options.
Turn HTML into tidy Markdown with tables, lists, links and code.
Align Markdown table columns and turn spreadsheet data into tables.
Find, dedupe and sort the email addresses hidden in any text.
Get a clean, deduplicated list of the links in any text, HTML or log
Pull phone numbers out of text and list them in E.164 or national format.