About the Text Separator
Text Separator splits a block of text into pieces on one separator and joins them back together with another. Choose the split from new line, comma, semicolon, tab, space, any run of whitespace, pipe, your own text or a regular expression, then choose the joiner: new line, comma, comma and space, a blank line, or anything you type. A typical job is turning a column pasted from a spreadsheet into a comma-separated list, or the reverse.
The cleanup options run in a fixed order: trim each piece, drop empty ones, remove duplicates (optionally ignoring case), then add quotes, a prefix and a suffix. Quotes can be double (JSON style), single with backslash escapes, backticks, or SQL strings where an inner quote is doubled, so the result drops into an IN (...) clause or an array literal. Custom text, prefix and suffix understand \n, \t and \\. A broken regular expression is reported with the browser's own message, and capture groups in a regex are never added to the output.
For one-way jobs there are simpler tools. Multiline to Single Line only joins, CSV to Multiline understands quoted CSV fields, and Delimited Text Extractor pulls out whatever sits between two markers. Use this page when the separator is unusual, when you need a regex, or when you want to split, clean and re-join in one step. For tidying the result, Remove Duplicate Lines and a line sorter are the next stop.
How to use
- Paste your text on the left, or use Upload to read a file.
- Choose what to split on and what to join with. For anything unusual, pick Custom text or Regular expression and fill in the box next to it.
- Turn on trimming, empty-item removal, duplicate removal, quotes, prefix or suffix as needed.
- Copy the result, or download it as a text file.
Common questions
- How do I split on several separators at once?
- Choose Regular expression and use a character class, for example
[,;|]for commas, semicolons and pipes, or[,;\s]+to include whitespace as well. - Can I type a tab or a new line as a custom separator?
- Yes. Write
\tfor a tab or\nfor a line break in the custom box, the prefix, the suffix or the joiner. A real backslash is\\. - What happens with an invalid regular expression?
- Nothing is converted. You get an error message that includes the reason the browser gives, such as an unterminated group, so you can fix the pattern.
- In what order are the options applied?
- Split, trim, drop empty items, remove duplicates, then wrap in quotes, then add the prefix and suffix, and finally join. The prefix and suffix therefore sit outside the quotes.
- Is my text uploaded?
- No. Splitting and joining happen in your browser, and the text is never sent anywhere.