Text tools

Add prefix and suffix to each line

Add the same text to the beginning and end of every line in one pass. Wrap a list in quotes, end each line with a comma or turn lines into tags, then copy or download the result. It runs in your browser.

Processed in your browser

Text to add

Each included line becomes Prefix + original text + Suffix. Either field can be empty. Text is literal; Enter inserts a real newline. Blank means empty or only spaces and tabs.

Editor text: CRLF and CR become LF. Downloads use UTF-8.

Result

Choose your options, then add prefix and suffix.

How to add text to the beginning and end of each line

  1. Type the prefix and suffix

    Prefix goes before each line and Suffix goes after it. Leave either one empty. Clear Include blank lines to skip empty lines.

  2. Add your text

    Type or paste into Input text, select Open UTF-8 file or select Example, then select Add prefix and suffix. File contents appear after processing.

  3. Save the result

    Select Copy or Download .txt. Running again uses the same source. Use as input moves the displayed result into the editor for another pass with LF line endings.

Common prefixes and suffixes

  • Quote each line for a list of values: Prefix a double quote, Suffix a double quote and a comma.
  • Add a comma to the end of each line: leave Prefix empty and set Suffix to a comma.
  • Make a bulleted list: set Prefix to a hyphen and a space.
  • Turn lines into HTML list items: Prefix <li>, Suffix </li>.

The Example button fills in five lines with [ as the prefix and ] as the suffix. With the default options the result is [Apples], [Café], [Tea], [] for the blank line and the indented line inside brackets with its spaces kept.

Questions

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

Type the text in Prefix, leave Suffix empty, paste your lines into Input text and select Add prefix and suffix. Every line starts with that text and the rest of the line stays as it was. Add a space at the end of the prefix if you want a gap.

How do I add text to the end of each line?

Type the text in Suffix and leave Prefix empty. The suffix goes after the last character of each line, before its line break, so a trailing space on a line stays in front of the suffix.

What happens to blank and final lines?

Blank lines are included by default. Uncheck Include blank lines to leave empty lines and lines containing only ASCII spaces and tabs unchanged. Other whitespace, such as a nonbreaking space, counts as content. A final line ending does not create an extra line. Empty input stays empty; empty prefix and suffix leave all input unchanged. Counts refer to original lines, even when an insert adds new lines.

Can I insert more than one line?

Yes. Press Enter in Prefix or Suffix to insert an LF newline; pasted CRLF and CR also become LF in these fields. The prefix goes before the original content and the suffix before its original line ending. Inserts are applied once per original line, never recursively. Backslashes, dollar signs, braces, quotes and HTML-like text remain literal. Nothing is escaped for CSV, JSON, SQL or HTML.

Are Unicode and line endings preserved?

Letters, emoji, combining marks and original whitespace remain intact. Lines are separated by CRLF, LF, CR, Unicode line separator or paragraph separator. UTF-8 file downloads preserve each original ending and a leading BOM before the first prefix, with no added final ending. File names and MIME types do not restrict valid UTF-8 input; malformed UTF-8 gives an error. Result and loaded-file previews display all line endings as LF line breaks. Typing or pasting into the editor normalizes CRLF and CR to LF. Editing a file preview or using the result as input uses the displayed LF endings; clipboard applications may also adapt endings. Downloads are plain UTF-8 text.

Is my text private? Can I cancel?

File decoding and processing run in your browser. Text and file names are not uploaded, logged or saved in browser storage. Cancel stops processing and keeps your input; Reset clears input, output and settings. There is no fixed text-length cap. Browser string and memory capacity still applies, and failures are reported. Very large editor previews may be less responsive.