Extended. Supports escape sequences such as \n for a new line and \t for a tab
Goes between the pieces. \s is a space; leave it empty to join with nothing
Drops lines that are empty or hold only the characters below
Removes spaces and tabs at the start and end of each piece
Advanced options
Extended. Supports escape sequences such as \n for a new line and \t for a tab
Where one piece ends. \n is a new line, so each line is a piece
Extended. Supports escape sequences such as \n for a new line and \t for a tab
A line made only of these counts as empty
Extended. Supports escape sequences such as \n for a new line and \t for a tab
What Trim chunks removes from each end
Fields marked Extended support .
Join lines into one
Joins lines of text into one, with a space between them by default, or a comma, a tab or any text you choose. Each line is trimmed and empty lines are dropped before the join, so a paragraph copied out of a PDF with ragged indents comes out with exactly one space between words.
At a glance
Joins with
A space by default, or any text. \n, \t and \s stand for a new line, a tab and a space.
First
Trims spaces and tabs from each line and drops empty lines. Both can be turned off.
Splits at
New lines by default, or any character you set
Runs
In your browser. Nothing is uploaded.
Cost
Free. No account, no limit, no ads.
Remove line breaks from copied text
Text copied out of a PDF, an email or a slide keeps the line breaks of its old layout. Paste it in and the output is one line. The example “Join words into a single sentence” under the box shows the cleanup: twelve lines with stray indents, one of them blank, become “Hello, I would have never thought that this would be possible.”
Hyphens at line ends stay, though. A word the PDF broke as “para-” and “graph” comes out as “para- graph”, so search the result for a hyphen followed by a space in Replace Text. Paragraph breaks go as well: two paragraphs become one.
Turn a column into a comma-separated list
Set the join character to a comma and a space, and a column copied from a spreadsheet becomes one line: apple, banana and cherry on three lines turn into apple, banana, cherry. Type the space, or use ,\s; both give the same result. For the way back, from one line to a column, use Split Text.
Join cells in Excel or Google Sheets
When the text is already in a sheet, a formula does the same job in both Excel and Google Sheets:
A range with a separator:=TEXTJOIN(", ", TRUE, A1:A10). TRUE skips empty cells. In Excel it needs Excel 2019 or Microsoft 365.
Two or three cells:=A1 & " " & B1 puts a space between them.
No separator:=TEXTJOIN("", TRUE, A1:A10) runs the cells together.
Join, then copy
Paste or type your text, one piece per line.
The joined line appears next to it, with a space between the pieces.
For a comma or anything else between them, change Join character in Options.
Copy the result.
Questions
How do I concatenate strings online?
Put each string on its own line and paste them in. They come out as one line with a space between them. To run them together with nothing in between, clear Join character in Options; for a comma or a slash, type that instead. It's quicker than a formula when the strings aren't in a spreadsheet.
How to remove line breaks from text
Paste the text and every line break becomes a space.
Copy the text with the unwanted line breaks
Paste it into the box on this page
The output is one line, with one space where each line break was
For no space at all, clear Join character in Options
Copy the result
How to combine multiple lines into one
Merge lines into one line with the separator you choose.
Paste the lines into the box on this page
Leave Join character as a space, or change it to a comma and a space in Options
The output reads "Line1 Line2 Line3", or "Line1, Line2, Line3" with the comma
Copy the result
How to convert a list to a comma-separated string
Turn items on separate lines into one comma-separated line.
Paste the items, one per line
In Options, set Join character to a comma and a space
The output reads "item1, item2, item3"
If the items had brackets or quotes, remove them with Replace Text
How to remove extra line breaks
Drop the blank lines and keep one line break between the lines that have text.
Paste the text into the box on this page
In Options, set Join character to \n
Leave Delete empty chunks on: the blank lines are dropped and every other line stays on its own line