Text to One Line Converter
Paste multi-line text, pick a separator, and get a single clean line ready for a CSV cell, a JSON string, a URL parameter, or a command-line argument. Runs in your browser.
Join with
How to convert text to one line
1. Paste the text
Drop the multi-line text into the Input box. Paste from a spreadsheet column, a vertical list, a code editor with hard-wrapped strings, an export file, or anywhere else. The tool reads Unix, Windows, and Mac line endings without any setup. See also: Twitter character limit.
2. Pick a separator
Each line break becomes whatever you choose: a single space (default, fine for prose and most generic flattening), no separator (concatenate the lines into one continuous string), a period plus space (when every line is a self-contained sentence), or a custom string (anything from a comma to a pipe).
3. Set the toggles
Three toggles control edge cases. Preserve paragraph breaks turns two or more newlines in a row into a pipe marker (|) so the result stays on one line but you can still see where paragraphs ended. Collapse multiple spaces runs after the join so the result never contains runs like "word word". Trim leading and trailing whitespace strips stray indentation per line before joining.
4. Convert and copy
Click Convert. The output appears on the right with a count of how many lines were collapsed and how many characters the single-line result contains. Use the Copy button to grab the result, or Download to save a .txt file.
When you need text on one line
Flattening multi-line text into a single line is the boring middle step in a lot of workflows. Here are the cases the tool was built for.
$1.How is this different from Remove Line Breaks?
The two tools share an engine but ship with opposite defaults, because they answer two different questions.
Remove Line Breaks defaults to Preserve paragraph breaks ON. Single newlines collapse but blank-line paragraph boundaries stay as real newline characters in the output. This is what you want when you copy text out of a PDF and want it to keep reading as paragraphs in the destination.
Text to One Line defaults to Preserve paragraph breaks OFF. Every newline of every kind collapses so the result is one uninterrupted line. This is what you want when the destination is a CSV cell, a JSON string, a URL parameter, or any other slot that must be a single line.
If you started on the wrong tool, the toggles let you flip behavior either way. But picking the tool that matches your default need saves a click. Reach for Remove Line Breaks when you are cleaning prose. Stay on this page when you are flattening structured data or any other one-line target.
Separator examples: paragraph block to single line
The "Join with" setting controls what gets dropped between the old line endings. Six common separators and what they produce, using the same three-line input:
Input (all examples):
Coffee Tea Water
" "", "" | "" - "" > """Related tools
Frequently asked questions
How do I turn multi-line text into one line?
Paste the multi-line text into the input box. Leave the default Join with set to Single space. Turn off Preserve paragraph breaks if you want everything on one line. Click Convert and copy the result. The output is a single line ready to paste into a CSV cell, a JSON string, a URL parameter, or a command-line argument.
What is the difference between this tool and Remove Line Breaks?
Remove Line Breaks is the prose-friendly version. It defaults to keeping paragraph spacing so a PDF copy still reads as paragraphs. Text to One Line is the strict flattener. It defaults to producing a single uninterrupted line so the result drops cleanly into a single cell, string, or argument. Same engine, different defaults.
Can I keep paragraph boundaries visible after flattening?
Yes. Turn on the Preserve paragraph breaks toggle. The tool detects paragraph boundaries as two or more newlines in a row and inserts a pipe marker (the | character) between them, so the result stays on one line but you can still see where paragraphs ended. Find-and-replace the pipe later if you need a different marker.
Does the tool handle Windows (CRLF) and Mac (CR) line endings?
Yes. The tool normalizes LF, CRLF, and CR before joining. You can paste text from any operating system, any editor, any export pipeline. The output is a single line with no remaining newline characters of any kind.
How do I flatten a list into a comma-separated string?
Paste the list. Pick Custom as the Join with option and enter ", " (a comma plus a space) in the custom field. Turn on Trim leading and trailing whitespace so stray indentation does not survive. Turn off Preserve paragraph breaks so every line joins into one row. Click Convert. The output is a comma-separated string ready for code, a spreadsheet formula, or a SQL IN clause.
Will the output be a valid JSON string?
It removes the raw newlines that would otherwise make a JSON value invalid, which is the most common blocker. The result is safe to drop between quotes if your text does not contain other JSON-special characters (double quotes, backslashes). If it does, escape those separately or use a JSON-aware string builder in your code.
Why does my result have double spaces?
If a line ended with a trailing space, joining lines with a space leaves two spaces in a row. Turn on the Collapse multiple spaces toggle, or the Trim leading and trailing whitespace toggle, to fix this. Both run before the final join.
I'm collapsing multi-line database queries and prompt drafts into a single line. Are those queries seen by anyone?
No. The line-flattening pass runs locally in JavaScript. SQL queries, prompt drafts, JSON, and anything else you collapse all stay on your device. We never transmit, log, or cache the content. See also: Remove Whitespace. See also: All converters.
More wordcounter.ai tools
Other tools you might find useful.