Text Separator

Split a list and re-join it with any separator, quotes or prefix

Turn a list separated by new lines into a comma-separated list (or any other separator) and back again. Remove duplicates, sort naturally, and wrap each item in quotes or a prefix/suffix - perfect for SQL IN (...) lists and CSV.
Try an example:

Output will appear here...

About Text Separator

How it works

  1. The text is split into items using the separator you choose (new lines, commas, tabs... or your own).
  2. Each item can be trimmed, de-duplicated and sorted naturally (item2 before item10).
  3. Items can be wrapped in quotes - with quotes inside an item doubled, as SQL and CSV expect - and given a prefix or suffix.
  4. Finally the items are joined with the new separator.

What you need

  • A list in any format: one item per line, comma-separated, tab-separated (copied from a spreadsheet column)...

Tips

  • SQL IN list: split by new line, join with ", ", wrap in single quotes → 'a', 'b', 'c'.
  • Copy a spreadsheet column and split by new line to turn it into a comma-separated list.
  • Use \n or \t in custom separators for new lines and tabs.

Limitations

  • Separators inside quoted CSV fields are not treated specially - use CSV to JSON for real CSV files.

Runs in your browser. Your text never leaves your browser.

Frequently asked questions

How do I make a list for a SQL IN clause?+

Paste one value per line, join with a custom ", " separator and wrap items in single quotes. Apostrophes inside values are doubled (O''Brien), which is how SQL escapes them.

What is natural sorting?+

Sorting numbers by value inside text, so "file2" comes before "file10" - the way people expect, unlike plain alphabetical order.

How do I use a tab or new line as a custom separator?+

Type \t for a tab and \n for a new line in the custom separator field.

Can I split by a word?+

Yes - choose Custom and type the word or symbol to split on, such as " and " or " | ".