Join lines into one line with commas, quotes or any separator

Paste one item per line and the tool joins them into a single line, with a separator of your choice between items and optional single or double quotes around each one.

Live demo · real result from this tool
Wrap each item

Result

apple, banana, cherry

Processed on your device — nothing is uploaded.

How to use the line joiner

  1. Paste your list into One item per line.
  2. Pick a separator in Join with: comma, comma and space, semicolon, tab, pipe, space, nothing, or Custom….
  3. If you chose Custom, type it in Custom separator. You can write \n or \t for a line break or a tab.
  4. Choose Wrap each item: no quotes, ‘single’ or “double”.
  5. Leave Skip empty lines and Trim each item ticked unless the spaces and gaps matter. The joined line updates as you type; press Copy to take it.

What it does and when to use it

Lists often arrive one per line: a spreadsheet column, a list of IDs from a report, tags you typed in a notes app. Many places want them on one line instead, such as a search filter, a code array, a tag field or a database query. Joining by hand is slow and easy to get wrong, especially with quotes.

Typical jobs:

  • Code and queries. Quote each ID for an SQL IN list or a JavaScript array.
  • Tag and email fields. Join with “Comma and space” or “Semicolon ;” for forms that accept several values.
  • Tab-separated rows. Join with Tab to paste a column across a spreadsheet row.

If the list needs cleaning first, run it through remove duplicates or the text sorter, then join it here.

How it works

The text is split at every line break (Windows, Mac and Unix line endings all work). With Trim each item on, spaces at the start and end of each item are removed. With Skip empty lines on, items that are empty after trimming are dropped. When you choose a quote style, any matching quote inside an item is doubled, and the item is wrapped in that quote. Finally the items are joined with your separator. Everything runs in your browser.

Worked examples

These results come from the tool’s own function.

Plain list. apple, banana, cherry on three lines, default settings, gives apple, banana, cherry.

SQL list with a messy paste. Lines 1001, 1002, an empty line and 1003 with spaces, joined with “Comma ,” and ‘single’ quotes, gives '1001','1002','1003'. Trimming removed the spaces and the empty line was skipped.

A name with an apostrophe. O'Brien and Smith with ‘single’ quotes and “Comma and space” gives 'O''Brien', 'Smith', so the query stays valid.

Limits and tips

  • The quote doubling suits SQL and CSV. Languages that escape with a backslash, such as JavaScript, may need double quotes instead, or a small edit.
  • There is no option to wrap the whole result in brackets; type ( and ) around it yourself.
  • To add text before or after each line rather than join them, use add prefix and suffix. To merge wrapped lines of prose into paragraphs, remove line breaks is the better fit.

Frequently asked questions

How do I turn a column from a spreadsheet into a comma-separated list?
Copy the column, paste it into the box and keep "Comma and space" as the separator. Each cell arrives on its own line, so the result is one line such as "apple, banana, cherry".
Can I make a list for an SQL IN clause?
Yes. Choose "Comma ," and set Wrap each item to 'single'. Lines 1001, 1002 and 1003 become '1001','1002','1003', ready to put inside IN ( ).
What happens to a quote mark that is already inside an item?
It is doubled, which is how SQL and CSV escape quotes. O'Brien wrapped in single quotes becomes 'O''Brien'.
Why did my blank lines disappear?
The option "Skip empty lines" is on by default, so blank lines do not create empty items or double separators. Untick it if you need the gaps kept.
How do I split the joined line back into lines?
Use the text splitter, which does the opposite job and puts each item on its own line again.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close