Home › Text Tools › Add Prefix and Suffix to Lines

Add Prefix and Suffix to Lines

Paste a list, type what should go before and after each line, and get the result instantly. Presets wrap lines in quotes, add commas, bullets or HTML tags and turn a column of values into a SQL IN list.

Last updated:

Quick presets

Use {n} in the prefix or suffix for the line number. \t inserts a tab.

Advertisement

How to use the Add Prefix and Suffix to Lines

  1. Paste your lines into the left box, one item per line.
  2. Type a prefix and a suffix, or pick a preset such as double quotes, comma at end or SQL IN.
  3. Choose options: skip or remove empty lines, trim spaces, or join everything into one line with a separator.
  4. Use {n} in the prefix or suffix to insert the line number, starting from any number you like.
  5. Press Apply, then copy the result or download it as a text file.

Common prefix and suffix recipes

Most list-formatting jobs come down to a handful of prefix and suffix combinations. Each example below turns the input lines red, green and blue into the result shown.

GoalPrefixSuffixOther optionsResult
JavaScript or Python array items"",none"red", "green", "blue", (one per line)
SQL IN list''Join with , , wrap in IN ( … )IN ('red', 'green', 'blue')
Markdown bullet list- (empty)none- red / - green / - blue
Markdown task list- [ ] (empty)none- [ ] red …
HTML list<li></li>Wrap in <ul>\n … \n</ul><ul> <li>red</li> … </ul>
Numbered steps{n}. (empty)Start at 11. red / 2. green / 3. blue
CSV row""Join with ,, quotes doubled"red","green","blue"
Hashtags#(empty)Join with a space#red #green #blue

Escaping quotes inside your text

If a line already contains the same quote character you wrap it in, the output breaks: 'O'Neil' is not valid SQL. The Quotes inside text option fixes this before the prefix and suffix are added:

  • Double them is the SQL and CSV rule: O'Neil becomes O''Neil and say "hi" becomes say ""hi"".
  • Backslash is the rule for JavaScript, JSON-like strings, PHP and many shells: O'Neil becomes O\'Neil, and existing backslashes are doubled first.
  • Leave as is keeps the text untouched, which is right for bullets, HTML tags and plain text.

How the line counter and empty lines work

The tool splits your text at every line break (Windows, Mac and Linux line endings are all recognised) and processes each line in order. A line that contains only spaces counts as empty. With Skip empty lines on, empty lines stay in place but get no prefix or suffix and are not numbered, so a list with blank separators keeps its layout. With Remove empty lines on, they disappear from the result. When Join lines into one is on, empty lines are dropped so you never get doubled separators such as a, , b. The {n} token counts only the lines that actually receive the prefix and suffix.

Frequently asked questions

How do I add text to the beginning of every line?

Type the text in the Prefix box. It is added to the start of each line as you type. Leave the Suffix box empty if you only need a prefix.

How do I add a comma to the end of each line?

Click the Comma at end preset, or type a comma in the Suffix box. To wrap each line in quotes as well, set the prefix to " and the suffix to ", (quote then comma).

How do I turn a column of values into a SQL IN list?

Click the SQL IN preset. Each value is wrapped in single quotes, quotes inside values are doubled so O'Neil becomes 'O''Neil', the lines are joined with a comma and the result is wrapped in IN ( … ).

What does Skip empty lines do?

Empty lines are left as they are instead of getting the prefix and suffix, and they do not count for the {n} line number. Tick Remove empty lines to delete them completely. When lines are joined, empty lines are always skipped.

Can I number the lines?

Yes. Put {n} anywhere in the prefix or suffix, for example {n}. or Step {n}: and set the number to start from. Only lines that receive the prefix are counted.

How do I insert a tab or a new line?

Type \t for a tab and \n for a line break in the prefix, suffix, separator or wrap boxes. For example a separator of \n\n puts a blank line between items.

Is my text uploaded anywhere?

No. All processing happens in your browser with JavaScript, so your text never leaves your device. Your options are remembered locally for next time.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Sort Lines AlphabeticallySort a list A-Z, Z-A, numerically, naturally or by length, or shuffle it.Remove Line BreaksStrip line breaks and extra spaces, keep paragraphs if you want.Text RepeaterRepeat any text or emoji up to 100,000 times with custom separators.Case ConverterConvert text to UPPERCASE, lowercase, Title Case, camelCase and more.Comma SeparatorTurn a column of lines into a comma separated list and back, with any delimiter.Online Word ProcessorFree browser word processor with headings, lists, tables and images. Autosaves; export DOCX or PDF.MLA Format GeneratorBuild an MLA 9 heading, title page layout and Works Cited entries.Lorem Ipsum GeneratorGenerate placeholder text as paragraphs, words or lists, with HTML.Find and Replace TextFind and replace words or regex patterns in any text, with match highlighting and undo.Add Line NumbersNumber every line of your text with custom start, step, padding and separator, or remove numbers.Text to Handwriting ConverterTurn typed text into realistic handwriting on notebook paper and save it as PNG or PDF.Japanese Kana ConverterConvert romaji to hiragana or katakana, kana to romaji, and hiragana to katakana instantly.Pinyin Tone ConverterTurn pinyin tone numbers (ni3 hao3) into tone marks (nǐ hǎo), or tone marks back into numbers.Remove Duplicate LinesDelete duplicate lines from any list, ignoring case or spaces, keep first or last, and sort.Remove Extra SpacesClean up double spaces, tabs, blank lines, non-breaking and invisible spaces in one click.Random Word GeneratorGenerate random English words by type, length, first letter and syllables, then copy them.List RandomizerShuffle a list into random order, pick random items or split it into fair teams.Email ExtractorPull every unique email address out of text or files, sort, filter by domain and export CSV.URL ExtractorExtract every link from text or HTML, remove duplicates, filter by domain or protocol.Strip HTML TagsRemove HTML tags and get clean plain text with line breaks and decoded entities.Online NotepadPrivate notepad that autosaves notes in your browser, with find, word count and .txt download.Remove PunctuationStrip all or only selected punctuation from text, with smart options for apostrophes and numbers.Text SplitterSplit long text into chunks by characters, words, lines or a delimiter, with numbering and copy.Remove AccentsStrip accents and diacritics from text (é→e, ñ→n, ß→ss, ø→o) instantly, live as you type.Sort NumbersPull numbers out of any text and sort them ascending or descending, with sum, average and median.Thread SplitterSplit long text into numbered X, Threads, Bluesky or Mastodon posts at sentence boundaries.Duplicate Word FinderFind repeated words in your text: doubled words like "the the" and overused words, highlighted.Alternating Caps GeneratorTurn text into aLtErNaTiNg caps, random caps or alternating words, then copy it.Random Paragraph GeneratorGenerate readable random English paragraphs by topic and length for writing and design.Random Sentence GeneratorGenerate random grammatical sentences: simple, compound, complex and questions.Markdown to Plain TextStrip Markdown syntax and keep clean plain text with lists, line breaks and link URLs.SRT to TextTurn SRT or VTT subtitles into a clean transcript with paragraphs, with or without timestamps.Transcript CleanerRemove timestamps, speaker labels and filler words like um and uh, and fix broken line breaks.Extract Numbers from TextPull every number out of text: decimals, negatives and percentages, with sum, average and CSV.Extract Phone NumbersFind phone numbers in any text, normalize them to E.164, remove duplicates and export CSV.Paragraph to Bullet Points ConverterSplit paragraphs into bullet points by sentence or clause, with your choice of bullet style.Compare Two ListsFind items only in list A, only in list B, in both lists, or in either, with copy and sort.DOCX to Text ConverterExtract plain text from Word .docx files, in batch, with list markers, tables and .txt download.Remove Text in BracketsDelete everything inside ( ), [ ], { }, < > or custom markers, with nested bracket support.Remove URLs from TextStrip links, www addresses and bare domains from text, plus emails, @mentions or hashtags.Trim Characters from LinesRemove the first or last N characters, or text before/after a marker, on every line.English to IPA ConverterConvert English text to IPA phonetic transcription in US or UK accent, with stress marks.Hidden Character DetectorFind and remove zero-width spaces, non-breaking spaces and other invisible Unicode characters.Letter to Number ConverterConvert letters to alphabet numbers (A=1 to Z=26) and back, with ASCII codes and letter sums.Markdown to Word ConverterConvert Markdown to a styled Word .docx file with headings, lists, tables, code and links.Plural GeneratorConvert English nouns from singular to plural and back, irregulars included, one word per line.Remove Empty LinesDelete blank and whitespace-only lines, or collapse gaps to one, with before/after line counts.Remove Text FormattingPaste rich text from Word, Google Docs or the web and get clean plain text instantly.Smart Quotes ConverterConvert curly quotes, dashes and ellipses to straight ASCII, or straight quotes to typographic ones.Text to HTML ConverterTurn plain text into clean HTML: paragraphs, line breaks, links, lists and escaped entities.Text to Word ConverterTurn text or a .txt file into a Word .docx with your font, margins and page size.WhatsApp Text FormatterFormat WhatsApp messages with bold, italic, strikethrough, monospace, lists and quotes, then copy.Word CombinerBlend two or more words into portmanteaus, compound and clipped names for brands and wordplay.Word to HTML ConverterConvert Word .docx files or pasted rich text into clean, semantic HTML with live preview.Word Wrap ToolWrap text at any column width with hard line breaks, indents and prefixes, or unwrap it again.Daily Affirmation GeneratorGet random positive affirmations by theme; save favorites, copy them or make an image card.Business Plan GeneratorFill in a guided form and get a formatted business plan with financial tables, as Word or PDF.Keyword Match Type ConverterTurn a keyword list into broad, "phrase", [exact] and negative match types for PPC ads.Discord Text FormatterFormat Discord messages with bold, spoilers, headers, quotes, lists and code blocks, with live preview.DNA Reverse ComplementGet the reverse, complement or reverse complement of DNA/RNA, FASTA and IUPAC codes supported.Filter Lines Containing TextKeep or remove lines that contain words or match a pattern, with match counts and regex.Focus Reading ConverterBold the first letters of every word for faster, focused reading. Copy as rich text or HTML.Memo GeneratorWrite a business memo in standard To/From/Date/Subject format, then print, copy or save as .docx.PDF Text CleanerFix text copied from a PDF: join broken lines, undo hyphen splits, drop page numbers and headers.Pros and Cons List MakerWeigh a decision with a weighted pros and cons list, a score, a verdict and easy export.Remove Numbers from TextStrip all numbers and digits from text, keep MP3-style words or ordinals, and tidy the spaces.Return Policy GeneratorCreate a return and refund policy for your store as text or HTML, with a refund example.Screenplay FormatterType a script in plain text (Fountain) and get a properly formatted screenplay, page count and PDF.
See all 96 Text Cleaning & Formatting →