Text & Writing Tools

Add Prefix and Suffix to Each Line Online

Paste your text, type a prefix and a suffix, and this tool adds them to every line. You can also choose to skip empty lines. Copy the result or download it when you are done.

0 characters

Options

Processing runs in this page using JavaScript. Do not paste confidential text on a shared device.

Why use this tool?

Why use this tool?

Lists often need the same text at the start or end of each line: quotes around words, a dash before each item, a comma or semicolon after it, a domain before each name. Doing this line by line by hand is slow. This tool does it for the whole list in one step.

How to use it

How to use it

  1. Step 1

    Add your text

    Paste or type your text in the input box, one item per line, or click Load example.
  2. Step 2

    Type the prefix

    Enter the text that should go at the start of every line.
  3. Step 3

    Type the suffix

    Enter the text that should go at the end of every line.
  4. Step 4

    Choose skip empty

    Turn on skip empty if you want empty lines left unchanged.
  5. Step 5

    Copy or download

    Check the result, then copy it or download it.

How to add prefix and suffix to each line

Paste your text with one item per line. Fill in the prefix option (text added at the start of each line) and the suffix option (text added at the end of each line). The result shows every line with your prefix in front and your suffix at the end, joined back together with line breaks.

Add suffix to the following words: a copyable sample

Copy this into the input box, one word per line. Input text: apple, banana, an empty line, then cherry. Set the prefix to '- ' (a dash and a space) and the suffix to ';'. With skip empty turned off, the result is: '- apple;', '- banana;', '- ;', '- cherry;'. The empty line also gets a prefix and suffix. With skip empty turned on, the empty line stays empty and the other three lines are the same.

What the skip empty option does

By default skip empty is off, so every line gets the prefix and suffix, even an empty one. When you turn it on, lines that are empty or contain only spaces are left as they are. Use it when your text has blank lines between groups that you do not want to change.

Features explained

Add prefix to every line

The prefix text is put at the start of each line. It is added exactly as you type it, so spaces are kept.

Add suffix to every line

The suffix text is put at the end of each line, exactly as you type it.

Skip empty lines

Turn this on to leave empty lines, and lines with only spaces, unchanged. It is off by default.

Load example

Fills the tool with sample text so you can see how it works before using your own.

Copy and download

Copy the result to your clipboard in one click, or download it. The copy button shows Copied! when done.

Clear

Resets the tool so you can start again with new text.

What can you use it for?

Add prefix or suffix to lines online

Put the same start or end on every line of a list, such as a dash, a number sign or a word.

Quote and separate items

Wrap each item with quotes by using one as prefix and one as suffix, or add a comma or semicolon at the end of each line.

Names, links and codes

Put a fixed beginning, such as a domain or folder name, in front of each name, and a fixed ending after it.

Keyword lists

Add the same words before or after every keyword in a list when you prepare content or data.

Tool information

Tool typeAdd prefix and suffix to each line
OptionsPrefix, Suffix, Skip empty lines
Default valuesPrefix: empty, Suffix: empty, Skip empty: off
Works onEach line of the input text
OutputThe changed lines, joined with line breaks
SpacesPrefix and suffix are added exactly as typed
ProcessingIn your browser, using JavaScript

Benefits

  • One prefix and one suffix are applied to the whole list in one step.
  • Skip empty keeps blank lines between groups untouched.
  • Prefix and suffix are added exactly as you type them, so you control every space.
  • The tool code we checked makes no network request for your text.

Limitations

  • The same prefix and the same suffix are used for every line. The tool does not number lines or change them line by line.
  • It adds text to the start and end only. It does not change the text inside a line.
  • No space is added for you. If you want a space after the prefix or before the suffix, type it in the option.
  • Always check the result before you use it in important work.

Your text stays in the page

Processing runs in this page using JavaScript. The tool code we checked does not send your text to a server. Still, do not paste confidential text on a shared or public device.

Tips

  • Click Load example first to see how the tool works.
  • To get '- item', type a dash and then a space in the prefix option.
  • If blank lines in your text should stay blank, turn on skip empty.
  • Put one word or item on each line before you start.

Frequently asked questions

How do I add a prefix or suffix to lines online?

Paste your text with one item per line, type the prefix and the suffix, and read the result. Every line gets both. Then copy or download the result.

How do I add a prefix and suffix online to each word?

Put each word on its own line, then enter the prefix and the suffix. The tool works on lines, so one word per line gives each word its own prefix and suffix.

How do I add a suffix to the following words?

Paste the words with one on each line, leave the prefix empty, and type the ending in the suffix option.

What does skip empty do?

When it is on, empty lines and lines with only spaces are left unchanged. When it is off, which is the default, they also get the prefix and suffix.

Why does my empty line show a prefix and suffix?

Skip empty is off by default, so empty lines are changed too. Turn it on to leave them alone.

Does the tool add spaces for me?

No. The prefix and suffix are added exactly as you type them. Type a space in the option if you want one.

Is my text sent to a server?

Processing runs in the page using JavaScript, and the tool code we checked makes no network request for your text. Do not paste confidential text on a shared device.