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.

Text to One Line Text Repeater Split Text Line Break Adder soon Add Prefix and Suffix soon
Input Load sample

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.

CSV cell preparation
A spreadsheet cell treats a real newline as a line break inside the cell, which breaks downstream imports, exports, and SQL loads. Flatten the value first so the cell holds a clean one-line string.
JSON string preparation
A JSON string value cannot contain a raw newline character. Strip the line breaks before pasting between quotes. Keep Collapse multiple spaces on so the value does not pick up weird internal whitespace.
URL parameter encoding
Query strings and form-encoded values do not survive newline characters in most clients. Flatten the text first, then URL-encode the result, before passing it to an API or a deeplink.
Command-line input
When piping text into a shell argument or building a one-liner, embedded newlines change how the shell parses the input. A single-line value behaves predictably whether you quote it or pass it as $1.
Programmatic string concatenation
When building a string in code from a copy-pasted block of text (an email template, a prompt, a fixed message), flatten it first so the source you paste matches the destination encoding without an unexpected newline mid-string.
Social-post flattening
Many social post composers, bio fields, and ad-copy boxes only allow a single line of input. Flatten a multi-line draft to one line with comma separators or pipes so the structure is still readable when pasted.

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
Space (default)
Join with: " "
Coffee Tea Water
Best for prose. The output reads as a normal sentence-style sequence.
Comma + space
Join with: ", "
Coffee, Tea, Water
Best for inline lists, CSV cells, or chat-message enumerations.
Pipe
Join with: " | "
Coffee | Tea | Water
Best for log lines, Slack-status strings, breadcrumb fallbacks.
Dash with spaces
Join with: " - "
Coffee - Tea - Water
Readable for headers, page titles, or meta descriptions.
Chevron
Join with: " > "
Coffee > Tea > Water
Breadcrumb style. Useful for navigation paths or step sequences.
Empty (strip newlines, no separator)
Join with: ""
CoffeeTeaWater
Concatenates raw. Useful for stripping newlines from base64 blocks, hex strings, or hash inputs where any whitespace would corrupt the value.

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.

Browse the full catalog →