Join Lines Tool

Combine lines into one line.

Result

apples bananas cherries

How it is calculated

The tool turns a block of text with several lines into a single line. It trims whitespace from both ends of the whole text, splits it wherever there is a line break (Windows \r\n, Unix \n or old Mac \r), ignores empty lines, trims spaces and tabs from the start and end of every remaining line, and joins the lines with exactly one space. Spaces inside a line are left as they are. The separator is always a space; you cannot choose a comma or other delimiter here. If the box is empty no result is shown. A text that contains only blank lines gives an empty result.

Worked example

Suppose the input has three lines: apples, then bananas with extra spaces, then a blank line, then cherries. The blank line is dropped and the spaces around bananas are trimmed. The pieces are joined with single spaces, giving apples bananas cherries. A line such as a, b keeps its comma and inner space, so "a, b" followed by "c" becomes "a, b c".

Try this example →

Common mistakes

  • Expecting commas between the items. The joiner is a plain space, so a list pasted from a spreadsheet will not become comma-separated.
  • Expecting blank lines to be kept as paragraph breaks. All empty lines are removed, so separate paragraphs end up merged.
  • Expecting extra spaces inside a line to be collapsed. Only the start and end of each line are trimmed.
  • Pasting text with line wraps from a PDF and expecting hyphenated words to be repaired. A word split as "infor-" and "mation" will come out as "infor- mation".
  • Leaving the box blank or filled with only spaces, which gives no useful output.

About this calculator

This tool merges every line of a block of text into a single line, replacing the line breaks with a single space. It's the reverse of splitting text into lines, and it processes pasted content instantly without needing a spreadsheet or text editor macro.

Developers turning a column of values into one line to paste into code, writers collapsing a list into a single sentence, and anyone cleaning up text copied from a PDF (which often breaks mid-sentence at the end of every line) use this to reformat text in one step instead of manually deleting dozens of line breaks.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    The tool trims each line, drops empty ones and joins the rest with a single space. That makes it a quick cleaner for ragged pasted lists: a column of names with stray gaps and blank rows becomes one tidy line. It cannot insert commas or other separators, so those need a follow-up edit. Which separator would you like a future version to offer?

Popular calculators

All Calculators