Add a prefix to every line

Add prefix attaches a string of your choice to the start of every line, every paragraph, or once at the top of the whole block. The default scope is per-line. Toggle Skip Empty on to leave blank lines unprefixed. To attach text on the right side of each line instead, see add suffix to each line.

Input
Line 1:1 LF cloud_done Saved locally
Result Add Prefix to Lines
0 lines 0 chars

Prefix every line, paragraph, or the whole block

Prefix is the string to attach. Scope picks where it goes. Per Line (the default) inserts it at the start of every line, including blank ones unless Skip Empty is on. Per Paragraph inserts it once at the start of each paragraph (a paragraph is a run of lines separated by two or more line breaks). Whole Text inserts it once at the very start of the input.

Skip Empty looks at line.trim() === '' for the per-line scope, so a line with only spaces or tabs counts as empty and is left alone. For the paragraph scope the same check applies to whole paragraph chunks. Whole-text scope ignores the toggle because there is only one insertion point.

Common uses: turning a list into a Markdown bullet list (- per line), commenting out a code block (// or # per line), or adding a header tag (INTRO: whole text). To wrap each line on both sides at once use wrap each line.

How to use add a prefix to every line

  1. 1Paste your text into the input panel on the left.
  2. 2Type the string you want to prepend into the Prefix field.
  3. 3Pick a Scope: Per Line, Per Paragraph, or Whole Text.
  4. 4Toggle Skip Empty on if you want blank lines or blank paragraphs left untouched.
  5. 5Click Copy or Download in the output header to take the result.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Three scope modes, line is the default

The Scope select picks the unit. Per Line splits on \r?\n and prepends to each piece. Per Paragraph splits on two-or-more line breaks (the separator chunks pass through unchanged). Whole Text just prepends once to the entire string.

Skip Empty is whitespace-aware

A line counts as empty if trim() returns an empty string, so spaces and tabs do not block the skip. With the toggle on, those lines pass through unchanged and unprefixed.

Paragraph mode preserves separators

When Scope is Per Paragraph the blank-line separators between paragraphs are kept exactly as they were in the input, including the number of consecutive newlines.

Empty prefix is a no-op

If you leave Prefix empty the tool returns the input unchanged. Nothing is prepended, including in Whole Text mode.

Line endings are normalised on output

The split uses \r?\n, the join uses \n, so CRLF input becomes LF output in per-line mode. Whole-text mode preserves the input verbatim apart from the prepended string.

Worked example

Prefix - , scope Per Line, Skip Empty off. Turn the toggle on and the blank line between bravo and charlie stays bare.

Input
alpha
bravo

charlie
Output
- alpha
- bravo
- 
- charlie

Settings reference

Behaviour Effect on output
Prefix empty Input passes through unchanged.
Scope = Per Line Prefix is inserted at the start of every line. Default mode.
Scope = Per Paragraph Prefix is inserted once at the start of each paragraph (paragraphs split on two or more line breaks).
Scope = Whole Text Prefix is inserted once at the very start of the input.
Skip Empty off Every line or paragraph gets the prefix, including blank ones.
Skip Empty on Lines or paragraphs whose trim() is empty pass through unchanged.
Line endings Per-line and per-paragraph modes normalise CRLF to LF on output. Whole-text mode preserves input verbatim.

FAQ

How is a paragraph defined?
Two or more consecutive line breaks separate paragraphs. A run of non-empty lines with single line breaks counts as one paragraph.
Can I use a multi-character prefix?
Yes. The Prefix field accepts any string. Common choices are - for bullets, // or # for comments, or > for Markdown blockquotes.
Does Skip Empty ignore lines with only spaces?
Yes. The check is line.trim() === '', so spaces and tabs count as blank.
How do I add a suffix instead of a prefix?
Use add suffix to each line for the right side, or wrap each line for both sides at once.
Does anything upload?
No. The transform runs in your browser via JavaScript. Your text stays on your device.