Skip to main content

Remove line breaks from text

Remove line breaks from text copied from a PDF or an email, keeping paragraphs if you need to, or turn a list into comma-separated values.

  • Clipboard
  • Export
Automate

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Was this tool useful?

On this page

How does this tool work?

Text copied from a PDF, a plain-text email or a terminal often arrives broken into short lines. This tool removes those line breaks to rebuild continuous sentences, keeping the gap between paragraphs if you wish. It also turns a list with one item per line into values separated by commas, semicolons or tabs. The result follows your typing and nothing leaves your browser.

The text is split at every line ending (Windows CRLF, macOS and Linux LF, CR from old Mac files) and the lines are then joined with the chosen separator: a space by default, a comma, a semicolon, a tab, nothing at all or a separator you type. A custom separator is inserted as is; \n is not read as a line break there.

Spaces at the start and end of each line are removed before joining, which avoids double spaces when lines ended with a space. Turn the option off to join lines unchanged. Spaces inside a line are never touched; to collapse them, run the clean text tool afterwards.

Blank lines are skipped, so a list separated by gaps becomes one continuous run of values. With “Keep paragraphs”, one or more blank lines instead mark the end of a paragraph: the lines of each paragraph are joined and paragraphs stay separated by a blank line.

The tool does not rejoin words hyphenated at the end of a line: “process-” followed by “ing” becomes “process- ing”. Search for “- ” with find and replace if your text contains such breaks, taking care of genuine compound words.

How to use this tool

  1. Paste the text

    Type, paste or import the text or list to put on one line.

  2. Choose the separator

    Keep a space for prose, choose a comma or semicolon for a list, and decide whether to keep paragraphs.

  3. Copy the result

    Check where two lines meet, then copy the text or download it.

Use cases

Fix a copy from a PDF

Rejoin the sentences of an article or a contract that break at every line of the document, while keeping paragraphs.

Create a comma-separated list

Turn a column of values into one “a, b, c” line for a spreadsheet, a keyword field or a query.

Prepare recipients

Join a list of email addresses with a semicolon to paste it into the To field of an email client.

Examples

Text copied from a PDF

Space separator, paragraphs not kept: the whole text fits on one line.

Input

This text was copied
from a PDF and every
line is broken.

Second paragraph
here.

Result

This text was copied from a PDF and every line is broken. Second paragraph here.

Same text, paragraphs kept

With the option on, the blank line still separates the two paragraphs.

Input

This text was copied
from a PDF and every
line is broken.

Second paragraph
here.

Result

This text was copied from a PDF and every line is broken.

Second paragraph here.

List to comma-separated values

“Comma and space” separator: the spaces around “kiwi” and the blank line disappear.

Input

apple
pear
  kiwi  

banana

Result

apple, pear, kiwi, banana

Tips and best practices

  • For a CSV file, use a comma without a space by typing “,” as a custom separator.
  • If the values themselves contain commas, choose a semicolon or a tab so they can be split again without ambiguity.
  • Check the joins after copying from a PDF: a heading, a caption or a page number may have slipped into the middle of a sentence.
  • For the opposite operation, one item per line, use find and replace: search for “, ” and press Enter in the replacement field to insert a line break.

Frequently asked questions

Can I keep my paragraphs?

Yes. Turn on “Keep paragraphs”: the lines of each paragraph are joined and a blank line still separates paragraphs.

How do I get a comma-separated list?

Choose “Comma and space”, or “Custom” with “,” for a comma alone. Blank lines are skipped.

Are hyphenated words rejoined?

No. The tool cannot tell a line-end hyphenation from a real hyphen as in “well-known”. Fix those cases by hand or with find and replace.

Are Windows line endings handled?

Yes. CRLF, LF and CR are all recognised as line endings; no invisible carriage return is left in the result.

Is my text sent to a server?

No. The joining is done in your browser, including for an imported file.

Related tools

Tools similar or complementary to this one.

Similar tools

Remove extra spaces, repeated tabs and empty lines from copied text.

Text & writingFeaturedUse this tool

Automatically remove empty lines and lines containing only spaces from a text.

Text & writingUse this tool