Prepend or append text to every line

Prepend and append literal text independently to each physical line, with optional trimming and empty-row skipping.

freeworks offlinenothing uploaded
ToolPrefix/Suffix Adder
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

CRLF and LF input splits into rows, trimming runs first when selected, and each eligible row becomes prefix + row + suffix. The reconstructed output uses LF and counts only rows that actually received additions.

  • Both additions start empty, while trimming and skipping are off so no source characters disappear by default.
  • An empty final row from a trailing newline is treated like any other row unless skipped.

Worked example

Add prefix/suffix to lines
Add custom text before and after each line
Input
											Input: apple
banana
cherry
Prefix: - 
Suffix: ;
										
Output
												- apple;
- banana;
- cherry;
											

When to use this

SQL drafts gain -- comments, Markdown items gain dash prefixes, and batch-command filenames receive quotes or trailing delimiters.

Edge cases

  • A trailing newline creates one final empty row that receives the prefix and suffix when empty rows are included.
  • A spaces-only row is processed without trimming but becomes empty and skippable when trimming runs first.
  • Windows CRLF rows are rejoined with LF, so the visible text survives but original line-ending bytes do not.