Wrap each line with text

Wrap each line attaches an Open string at the start and a Close string at the end of every line. Either field can be empty; if both are empty the input passes through. Useful for turning a plain word list into a JSON array (" open, ", close), an HTML list (<li> open, </li> close), or any other line-by-line wrapper. To insert on one side only see add prefix or add suffix.

Input
Line 1:1 LF cloud_done Saved locally
Result Wrap Each Line
0 lines 0 chars

A prefix and a suffix on every line, in one pass

Open goes on the left of every line, Close goes on the right. The transform splits the input on \r?\n, wraps each piece, and joins with \n. Empty lines are wrapped too, so an empty input line becomes Open + Close; if you want to skip blanks, run the result through remove empty lines afterwards.

There are no scope toggles and no skip-empty switch on this tool. The behaviour is fixed: every line gets both wrappers. The simplicity is the point. If you need conditional wrapping use a regex via regex replace.

Typical recipes: build a JSON string array (Open ", Close ",), build an HTML list (Open <li>, Close </li>), or quote each item for a shell command (Open ', Close '). For multi-character padding instead of literal text, see pad left and pad right.

How to use wrap each line with text

  1. 1Paste your lines into the input panel on the left.
  2. 2Type the opening string into the Open field.
  3. 3Type the closing string into the Close field.
  4. 4Read the wrapped lines on the right.
  5. 5Click Copy or Download in the output header.

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

Both wrappers go on every line

Every line in the split result gets Open at the start and Close at the end, no exceptions. Blank lines become Open + Close on their own.

Either field can be empty

Leaving Open empty makes the tool act like an add-suffix-only transform. Leaving Close empty makes it act like add-prefix-only. Both empty is a pass-through.

Multi-character wrappers are fine

Strings of any length work. <li> and </li> for HTML lists, " and ", for JSON arrays, /* and */ for block comments. The wrappers are inserted verbatim.

Line endings are normalised on output

The split uses \r?\n and the join uses \n, so CRLF input becomes LF output. The wrappers themselves are inserted exactly as you typed them.

Runs entirely in your browser

A single split + map + join pass on every keystroke. Nothing uploads, nothing is logged.

Worked example

Open ", close ",. The output is now a comma-separated list of quoted strings ready to paste between [ and ] for a JSON array.

Input
apple
banana
cherry
Output
"apple",
"banana",
"cherry",

Settings reference

Behaviour Effect on output
Open populated, Close populated Both wrappers attach to every line.
Open populated, Close empty Acts like add-prefix-only. Same effect as add prefix in line scope.
Open empty, Close populated Acts like add-suffix-only. Same effect as add suffix in line scope.
Open empty, Close empty Input passes through (CRLF still becomes LF on output).
Blank input lines Wrapped too. The output line is Open + Close. Drop them later with remove empty lines if needed.
Line endings CRLF input becomes LF output.

FAQ

How do I make a JSON string array?
Set Open to " and Close to ",, then put [ at the top and ] at the bottom with add text to top and add text to bottom. The trailing comma on the last line is invalid JSON, so trim it manually.
Why are blank lines being wrapped too?
The transform wraps every line in the split result. Run remove empty lines first or after to drop them.
Can I wrap each word instead of each line?
Not with this tool. Run extract words first to get one word per line, then wrap.
Does it support HTML?
It inserts whatever you type, so <li> and </li> work fine. The output is plain text containing HTML markup.
Does anything upload?
No. The transform runs in your browser. Your text never leaves the page.