Add Prefix and Suffix to Lines

Wrap every line in a list with text, quotes or numbering.

Text Tools Free, no sign-up Runs in your browser

Add Prefix and Suffix to Lines tool

Line numbering
0 lines

About the Add Prefix and Suffix to Lines

Add Prefix and Suffix to Lines takes a plain list and puts the same text at the start or end of every line. It sounds small, and it is exactly the kind of small job that takes twenty minutes by hand and two seconds here when a list runs to hundreds of rows.

The usual reasons are mechanical. Wrapping each line in quotes and adding a comma turns a list of names into an array or a SQL IN clause. Adding a domain in front of each path turns a list of slugs into full URLs. Adding a bullet character or a dash turns a plain list into a Markdown list.

Line numbering is built in, with a choice of starting number, padding and separator, so you can produce 01. through to 99. without counting. An option skips blank lines so numbering stays continuous, and another trims each line before wrapping it, which matters when the list was pasted from a spreadsheet.

How to use the Add Prefix and Suffix to Lines

  1. Paste your listOne item per line.
  2. Enter a prefix, a suffix or bothEither can be left empty.
  3. Add numbering if you need itChoose the starting number, zero padding and the separator after it.
  4. Press Apply and copyThe rewritten list appears below, ready to use.

Features

  • Prefix, suffix or both on every line
  • Optional sequential numbering with a chosen start
  • Zero padding so numbers line up
  • Skip or keep blank lines
  • Trim each line before wrapping it
  • Shows how many lines were changed
  • Copy and download the result

Who uses this tool

The add prefix and suffix to lines is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:

  • Turning a list of values into a SQL IN clause or a code array
  • Adding a domain in front of a list of paths
  • Converting a plain list into Markdown bullets or a numbered list
  • Adding quotes and commas around every item for a CSV row
  • Numbering a list of steps or questions

Frequently asked questions

Can I wrap each line in quotes and add a comma?

Yes. Put a quote mark in the prefix box and a quote mark followed by a comma in the suffix box. That is the fastest way to turn a column from a spreadsheet into a list a programming language or a database will accept.

What does zero padding do?

It pads the number to a fixed width with leading zeros, so 1 becomes 01 or 001. Padded numbers sort correctly as text, which is why file names often use them.

Are blank lines numbered?

Only if you choose to keep them. With blank lines skipped, numbering stays continuous and empty rows pass through untouched.

Does trimming change my content?

It removes spaces and tabs at the start and end of each line only. Spacing inside a line is left alone. It is worth switching on when the list came from a spreadsheet, where trailing spaces are common and invisible.

Can I remove a prefix instead of adding one?

Use the Find and Replace tool for that. This tool only adds; removing a repeated opening string is a replacement job.

Is there a limit on list length?

No. The work happens in your browser and lists of many thousands of lines are handled without difficulty.

If the add prefix and suffix to lines is not quite what you need, these other free tools solve closely related problems.

Find and Replace Text

Replace text everywhere at once, with case options and regex support.

Text Tools Use tool

Text Sorter

Order any list A-Z, Z-A, by number, by line length, or simply reverse it.

Text Tools Use tool

Remove Duplicate Lines

Deduplicate any list of lines, with case-sensitive and empty-line options.

Text Tools Use tool

Text Cleaner

Tidy messy pasted text: extra spaces, empty lines, breaks and special characters.

Text Tools Use tool

CSV to JSON Converter

Turn spreadsheet data into JSON, or JSON records back into CSV rows.

Developer Tools Use tool