Lines to one line
Merge a line-based list into a single line joined by newlines — literal `\n` escapes by default (ready for code or JSON), a real newline, or any custom joiner, with optional per-line quotes, trimming and blank-line dropping.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Merged line
One single line, ready to copy.
Paste multi-line text to merge it into one line
Input lines: 0 · Merged: 0 · Dropped: 0 · Characters: 0
What this tool does
- Compress a multi-line list into one line for a code string constant or a JSON field.
- Build command-line input: one argument per line, joined into a single `\n`-separated string.
- Turn a copied spreadsheet column into a single line you can paste into a chat box.
Example
Input
apple banana cherry
Output
apple\nbanana\ncherry
By default the joiner is the literal `\n`, so the result is the single line `apple\nbanana\ncherry` — ready to paste into code or a JSON string.
Frequently asked questions
Is the default `\n` a real newline?
No — by default it is two characters, a backslash and the letter n, the escape form used in source code. Switch the joiner to “real newline” for an actual line break, or pick “custom” for anything else.
Why is there no trailing `\n`?
The joiner is only inserted between lines, never appended. That keeps the result safe to paste into JSON or code without a dangling newline; add one yourself via the custom joiner if you need it.
What happens to CRLF and trailing blank lines?
The input is normalized first: the BOM is stripped and CRLF, CR and LF all count as line breaks. A trailing blank line is dropped as an empty item by default, so "a\n" and "a" give the same result; turn off “Drop blank lines” to keep it.
Are Chinese characters or emoji split apart?
No. Splitting happens per line, never per character, so in-line Chinese and emoji survive untouched; the character count is measured in Unicode code points.
Keywords:转换行符合并成一行lines to one line\n转义换行行转字符串单行文本join lines