Skip to content
M2TOOLKIT

Text · free tool

Add Prefix and Suffix to Lines

Add the same text to the start or end of every line in seconds.

Use it as often as you like — it's free, with no sign-up and no limits.

  • Text
  • Free
  • No sign-up
  • Nothing is sent or stored
  • Updated

Tip: {n} inserts the line number.

0 characters

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved.

How to use the Add Prefix & Suffix to Lines

  1. Paste your lines.
  2. Type what to add before and after each line.
  3. Copy the result.

What does this tool do?

Handy for turning a list into code or markup: wrap each line in quotes and add a comma to build an array, add <li> tags for HTML, or put a dash in front for a bullet list.

Use {n} anywhere in the prefix or suffix to insert the line number. Empty lines can be skipped so numbering stays tidy.

Why use it?

  • Prefix and suffix together.
  • {n} line numbering.
  • Skips empty lines.

Use cases

  • Turn a list into a JavaScript or Python array.
  • Wrap lines in HTML tags like <li>.
  • Number lines or add bullets for documents.

Example

Prefix ' and suffix ', turns apple / banana into 'apple', / 'banana', — ready to paste into code.

Common mistakes

  • Forgetting to remove the comma after the last item when the language doesn't allow it.
  • Numbering blank lines — turn on skip empty lines.
  • Adding quotes to items that already contain quotes.

Privacy

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.

Frequently asked questions

How do I number lines?

Put {n} in the prefix, like “{n}. ”.

Can I add only a suffix?

Yes, leave the prefix empty.

Is my text uploaded?

No, everything runs in your browser.

Content last updated . See how M2Toolkit works.

Other tools people use alongside the add prefix & suffix to lines.