Skip to content
ToolPlankDEV
Text Tools
100% In-Browser Execution

Updated:

Add Text to Each Line

Use this tool to add text to each line of a list. Put text at the start or end of every line, wrap lines in quotes or HTML tags, or number them with {n}. It can also remove a prefix or suffix again. Nothing is uploaded.

Options:

Your lines

Input
0 chars Ā· 0 lines

Lines with the text added

Ready
Processing in browser...
0 chars Ā· 0 linesUpdates as you type

Processed on your device. Your text is not sent to our servers.

More free tools you may need next.

Quick Guide

How to use Add Text to Each Line

Simple step-by-step instructions to get the exact output you need.

  1. 01

    Paste your lines

    Paste the list into the Your lines box, one item per line, or press Paste, or drop a .txt file onto the box. Press Example to load a short list with a blank line in it.

  2. 02

    Type the text to add

    Start of line is added in front of every line and End of line is added after it. Both can be used together. A space at the end of the start text, such as "- ", is kept.

  3. 03

    Wrap, number or skip

    Wrap line in puts quotes, brackets or an HTML tag around each line. Writing {n} in the start or end text inserts the line number. Blank lines can be left alone, given the text too, or deleted.

  4. 04

    Copy the result

    The lines with the text added update as you type. Press Copy, or Download to save them. To take added text off again, set Action to Remove text and enter the same start and end text.

How to Add Text to Each Line

To add text to each line, paste the lines and type what you want in front of them in Start of line. The text is added to every line at once. This is the Example list with the default start text, a dash and a space:

Text
apple              - apple
banana             - banana
(blank line)       (blank line)
cherry             - cherry

Put text in End of line to add something after each line, for example a semicolon or a comma. You can fill in both boxes. Add text to the beginning and the end of each line in one pass, such as a quote before and after, or a tag before and after.

Add Quotes, Brackets or HTML Tags to Each Line

Wrap line in puts the same characters around each line, before the start and end text is added. With single quotes and a comma at the end of the line, the Example list becomes a ready list of quoted items:

Text
'apple',
'banana',

'cherry',

A quote that is already inside a line is doubled, as SQL and CSV do, so it's becomes 'it''s'. This is not the backslash escaping that JSON and most programming languages use. Round, square and curly brackets are added as they are.

The li, p and td choices wrap each line in an HTML tag. In that case the characters &, < and > inside the line are replaced with their HTML codes, so the result is valid HTML. The li choice gives you:

HTML
<li>apple</li>
<li>banana</li>

<li>cherry</li>

If you want the whole list on one line instead, with commas between the items, use Column to Comma Separated List, which also adds brackets for SQL.

Number the Lines with {n}

Anywhere in the start or end text, {n} is replaced with the number of the line, counting from 1. With the start text {n}. the Example list becomes:

Text
1. apple
2. banana

3. cherry

Blank lines are not counted while they are left alone. If you set Blank lines to Add text too, they are numbered like any other line. You can use {n} in both boxes, and with other text, for example Step {n}: .

Remove a Prefix or Suffix from Each Line

Set Action to Remove text. The tool takes the start text off every line that begins with it and the end text off every line that finishes with it. Lines that do not have the text are left as they are, and the match is case sensitive. With the start text - :

Text
- apple
- banana

- cherry

→  apple
    banana

    cherry

In this mode {n} and Wrap line in are not used. The characters you type are matched exactly as written. To take quotes off a list, enter the quote character in both Start of line and End of line.

Blank Lines and Spaces

  • Blank lines: Leave as they are is the default, so empty lines stay empty and do not get a lone dash or comma. Add text too puts the text on them. Delete them removes them from the result.
  • A line that has only spaces counts as blank.
  • Trim spaces first removes spaces at the start and end of each line before the text is added. Without it, the spaces stay and your text goes before them.
  • A trailing line break at the end of the list counts as one blank line.

If the lines need to be sorted first, use Sort Lines. To remove repeated lines before you add text, see Remove Duplicate Lines.

Adding Text in Notepad++ and Other Editors

Code editors can do this with a regular expression. In Notepad++, open Find and Replace, set the search mode to Regular expression, search for ^ and replace it with your text to add it at the start of every line. Searching for $ adds text at the end. In an editor without regular expressions, or in a word processor, it is easier to paste the lines here and paste the result back.

Text you add is inserted exactly as typed. Characters such as $, ^ and \ have no special meaning in this tool. The start and end text can each be up to 200 characters long.

Limits and Privacy

  • The start and end text have to fit on one line, because they are typed in a single-line box. Use Wrap line in for tags.
  • The tool adds text to whole lines only. It cannot add text inside a line or after a certain word.
  • Input is limited to 2,000,000 characters.

Your lines are processed by code running in your browser. They are not sent to a server and not stored. See the Privacy Policy for details.

Frequently Asked Questions

Technical Q&A for Add Text to Each Line

Common questions about edge cases, character encoding, and privacy guarantees.

Paste the lines and type your text into Start of line. It is added in front of every line straight away.

Type the text into End of line. A comma, a semicolon or a closing tag are typical examples.

Set Wrap line in to Single quotes or Double quotes. Add a comma in End of line if you also want a comma after every item.

Type a comma into End of line. If you want the items joined on one line instead, use the Column to Comma Separated List tool.

Yes. Type {n} in Start of line, for example {n}. , and each line gets its number starting from 1.

Set Action to Remove text and type the prefix into Start of line. It is removed from each line that starts with it.

Not by default. Blank lines stay blank. Set Blank lines to Add text too if you want them to get the text as well.

Open Find and Replace, choose Regular expression mode, search for ^ and replace it with your text. Or paste the lines into this tool and paste the result back.

Yes. Set Wrap line in to <li> </li>, or p or td. The characters &, < and > inside each line are escaped.

No. The lines are processed in your browser and nothing is sent to a server or saved. Reloading the page clears them.