Add Prefix and Suffix to Lines

Type what goes before and after each line, or pick a preset. Use {n} to number the lines.

Use {n} for line numbers.

Last reviewed:

Prefixes and suffixes for common jobs

Adding the same text to the start or end of every line turns a plain list into almost any format you need. Every row below starts from the same line: apples.

PrefixSuffixResultGood for
{n}. and a spaceNothing1. applesNumbered steps, agendas, rankings
A hyphen and a spaceNothing- applesBullet lists in Markdown
"","apples",Lists in code and JSON
'','apples',SQL lists, which use single quotes
https://shop.example/item/Nothinghttps://shop.example/item/applesBuilding links from names or IDs
#Nothing#applesHashtags
Nothing.jpgapples.jpgFile names

Numbering lines with {n}

{n} can go anywhere in the prefix or the suffix, and more than once. A prefix of Q{n}: turns a list of questions into Q1:, Q2: and so on, while a suffix of a space and ({n}) puts the number at the end of each line instead.

Example: Numbering photo captions

  1. Lines: Beach at sunset, Harbor market, Old town walls
  2. Prefix: Photo {n}: followed by a space
  3. Result: Photo 1: Beach at sunset, Photo 2: Harbor market, Photo 3: Old town walls

Numbered captions make it easy to refer to a picture in an email: “see photo 2”.

{n} counts only the lines that get a prefix. With empty lines skipped, a blank line stays blank and the numbering carries on across it, so a list split into groups still reads 1, 2, 3, 4 instead of starting over after each gap.

Numbers aren't padded with zeros, so line 10 comes out as 10, not 010. If you later sort the numbered lines alphabetically, 10 lands before 2. The natural sort in Sort Lines keeps them in counting order.

Turning a column into a SQL or code list

Spreadsheet columns, database exports and lists from colleagues usually arrive one item per line. Wrapping each item in quotes and adding a comma is most of the work of turning them into something a program can read.

Example: Product codes for a database query

  1. A column copied from a spreadsheet: A102, B215 and C330, one per line
  2. Prefix ' and suffix ', give 'A102', 'B215', and 'C330', each on its own line
  3. Join the lines with Remove Line Breaks
  4. Delete the comma after the last item

'A102', 'B215', 'C330' drops straight into a query such as WHERE code IN ('A102', 'B215', 'C330').

The suffix goes on every line, the last one included. In SQL and JSON that final comma is a syntax error, and the CSV format says the last field in a row must not be followed by a comma, so remove it by hand.

Values that contain the quote mark you're wrapping them in need escaping. SQL writes O'Brien as 'O''Brien', and CSV doubles a double quote inside a quoted field, so 12" pipe becomes "12"" pipe".

Making HTML and Markdown lists

For a web page, wrap each line in an opening and closing li tag, then put the whole set inside a ul element for bullets or an ol element for numbers. An li element only belongs inside a list container like those, so don't skip that last step.

Markdown, which many note-taking apps, chat tools and README files understand, needs only a prefix: a hyphen and a space for bullets, or a number, a period and a space for numbered items. That's exactly {n}. followed by a space.

More ways to use a prefix or suffix

  • Comment out a block of code by adding // or # to the front of every line.
  • Quote an email the old-fashioned way by putting > and a space before each line.
  • Add a semicolon after each address for mail apps that separate recipients with semicolons.
  • Make sample email addresses for testing by adding @example.com after a list of usernames.
  • Label a set of files or photos consistently, such as adding “2026-trip-” before each name.
  • Build a search for any of several terms: add a space and OR as the suffix, join the lines, and delete the final OR.

Clean the lines before you add anything

Prefixes and suffixes go on exactly what's there, invisible characters included. A trailing space in a spreadsheet cell becomes 'A102 ', which won't match anything in a database. Clean the list first with Remove Extra Spaces, and take out repeats with Remove Duplicate Lines so no item appears twice.

Then glance at the first and last lines of the result. An empty line at the very end of pasted text is easy to miss, and unless empty lines are skipped it gets a prefix and suffix of its own, turning up as an empty pair of quotes.

Sources and further reading

How to use it

  1. 1Paste your lines.
  2. 2Type a prefix, a suffix or both, or pick a preset.
  3. 3Copy the result.

Questions

How do I number lines?

Put {n} in the prefix, for example {n}. or ({n}), and each line gets its number. Empty lines are skipped and not counted when that option is on.

How do I turn a column of values into a quoted, comma-separated list?

Use the Quotes preset, which wraps each line in quotes and adds a comma. Then use the remove line breaks tool to put them on one line.

Is my text uploaded anywhere?

No. Everything happens in your browser; your text never leaves your device.

Also handy: Text to QR Code, Shuffle a List