Multiline to Single Line Converter
Convert multiline text, JSON, XML or any string to a single line. Choose how newlines are replaced.
About This Tool
This tool collapses multiline text into a single line by replacing newline characters with a delimiter of your choice space, comma, pipe, \n literal, or a custom string. It's invaluable for pasting multi-line JSON or XML into a single-line string variable, preparing data for shell commands that expect one-line input, joining CSV rows, and cleaning up log output. The reverse operation splits a single-line string back into multiple lines.
How to Use
- Paste your multiline text into the input field.
- Choose your replacement character space is common for JSON; comma for CSV lists.
- Click Convert and copy the single-line result.
- For the reverse (split a one-liner), switch to Single → Multiline mode and pick the split delimiter.
Frequently Asked Questions
Why do I need to convert JSON to one line?
Many CLI tools, environment variables, database fields, and API payloads require JSON to be on a single line. Multiline JSON is easier to read but can break scripts that parse line-by-line. Minified single-line JSON is also slightly smaller.
What's the difference between \r\n and \n line endings?
\n (LF) is the Unix/Mac line ending. \r\n (CRLF) is the Windows line ending. This tool handles both it strips \r characters before processing to produce consistent output regardless of the source OS.
Can I use a custom delimiter like a pipe |?
Yes. Select the Custom option and type any character or string as your delimiter. Pipes, semicolons, tabs (\t), or even multi-character sequences like | with spaces all work.