Add Text to Each Line

Add a prefix or suffix to every line, number your lines, or join them into one comma-separated line. Ideal for SQL lists, quoted values, CSV and code.

Some edits are tedious by hand and trivial for a computer: put a quote mark at both ends of every line, add a bullet at the start, number a list, or squash a column into one comma-separated line. This tool does all of them, alone or in combination.

What you can do

Add text at the start of each line. The “prefix” box takes anything: a bullet, a quote mark, a path, a tag. A prefix of - turns a plain list into a Markdown bullet list. A prefix of https:// can complete a list of bare domain names.

Add text at the end of each line. The “suffix” box works the same way at the other end. A suffix of , adds a trailing comma to every line, which is how you prepare items for a code array. A suffix of .com adds a domain ending.

Number the lines. Tick Add line numbers and every line gets a number in front. The format is flexible: {n}. gives “1. text”, Step {n}: gives “Step 1: text”, and [{n}] gives “[1] text”. Change Start at to continue from an earlier list.

Join all lines into one. Tick this and the lines are glued together using whatever you put in “Join with”. A comma and a space gives a classic comma-separated list. A pipe with spaces gives a tidy delimited string. An empty value joins everything with nothing in between. In the join separator, \n means a new line and \t a tab.

Leave empty lines alone. Blank lines normally shouldn’t get a prefix or a number, so by default they’re left as they are and skipped when joining.

Example recipes

A SQL IN list. Paste a list of IDs. Prefix ', suffix ', join with , . You get '101', '102', '103' ready to drop inside IN (...). For numeric IDs, clear the prefix and suffix.

A JSON or JavaScript array. Prefix ", suffix ", join with , , then add square brackets yourself at both ends.

Markdown bullets. Prefix - , don’t join.

Numbered steps. Tick numbering with the format {n}. and don’t join.

HTML list items. Prefix <li>, suffix </li>, no joining. Wrap the lot in a <ul>.

Hashtags. Prefix #, join with a space, after removing spaces within each phrase.

File paths or URLs. Prefix a folder or domain and suffix a file extension to complete a list of bare names.

Getting the list ready

The cleaner the list, the better the result. Remove repeats first with remove duplicate lines, then put the items in order with sort lines, then wrap or join them here. If your list contains stray spaces, the trimming in those tools handles that. For a bulk edit inside the lines, find and replace is the better choice.

Doing the reverse

Need to go the other way, from one long line back to a list? Use find and replace with regular expressions switched on: find , and replace with \n, and the commas become line breaks. If the text has unwanted line breaks and you want to squash it into paragraphs, the remove line breaks tool is the one.

To make many copies of the same line with prefixes and numbering, the line repeater is quicker, since it creates the lines for you.

A few things to watch

Quote marks inside your data can break a quoted list. If a line already contains a quote, the result may need escaping by hand. For anything going into a database or a program, double-check special characters before you run it.

Be careful about sensitive data. Building SQL by hand from pasted values is fine for quick one-off queries, but it isn’t a safe pattern for software that handles user input, where parameterised queries are the right answer.

Splitting, numbering and filtering

Joining is easier to undo than it looks: the text splitter cuts a comma-separated string back into one item per line, and it trims the spaces and drops empty pieces as it goes. When all you want is numbering with a choice of separator and zero padding, add line numbers is more direct. To keep only some of the lines before wrapping them, filter lines keeps or deletes every line containing a word or pattern.

Frequently asked questions

How do I turn a list into a comma-separated line?

Leave Join all lines into one ticked and set Join with to a comma and a space. Each line becomes an item in one long line. Add quotes as a prefix and suffix first if you need quoted values.

How do I add quotes around every line?

Type a quote mark in both the start and end boxes. The default settings already use single quotes, which suits SQL. Use a double quote for JSON or CSV.

Can I number lines starting from a different number?

Yes. Tick Add line numbers and set Start at to the number you want. You can also change the format, for example to Step {n}: instead of 1.

What does Leave empty lines alone do?

With it ticked, blank lines get no prefix, suffix or number, and they are skipped when joining. Untick it if you want every line, including blank ones, to be changed.