Advertisement
Advertisement

Remove Line Breaks

Paste your text, pick what to clean, and copy the result.

🔒 Runs in your browser. The text you paste is never uploaded or saved.
Sorting works when line breaks are kept.

How to use the Remove Line Breaks

  1. Paste or type your text into the first box.
  2. Under Line breaks, choose how to handle them: replace with a space, remove completely, join lines but keep paragraphs, or keep them.
  3. Tick the clean-up options you want: trim each line, collapse repeated spaces, remove empty lines. Pick a sort order if you want one.
  4. Press Copy result and paste the cleaned text where you need it.

How it works

Text copied from a PDF, an email or a web page often has a line break at the end of every line. That makes it hard to paste into a form, a spreadsheet cell or a document. This tool joins those lines back into flowing text. Different systems end lines in different ways, such as a line feed or a carriage return followed by a line feed. The tool handles all of them the same way.

The four line-break choices cover most cases. "Replace with a space" joins each line to the next with a single space, which is what you want for ordinary sentences. "Remove completely" joins lines with nothing between them, which suits things like a code split across lines. "Join lines, keep paragraphs" treats a blank line as a paragraph break, joins the lines inside each paragraph and keeps the blank line between paragraphs. "Keep line breaks" leaves the structure alone so you can trim, de-space or sort the lines.

The cleanup options run in order: each line is split out, trimmed, and optionally dropped if empty. Then lines are sorted if you asked for it, and then joined. Repeated spaces are collapsed last. Sorting uses a natural comparison, so "item 2" comes before "item 10". Sorting is ignored when lines are being joined, because the order of a single block of text should not change.

For a quick example, "Hello" on one line and "world" on the next becomes "Hello world" with the space option and "Helloworld" with the remove option. Everything happens in your browser, so private text stays on your device.

When this tool helps

Copying from a PDF is the classic case, but there are many others. Email programs insert breaks when they wrap long lines, so a quoted message can arrive with a break every 70 characters. Addresses on several lines may need to go on one line in a spreadsheet cell. Lists copied from a web page may need to become one comma-separated line, which you can do by removing the breaks and then replacing the spaces. Poems, lyrics and subtitles often have breaks you want to keep, and in that case you can use the "Keep line breaks" option to just trim and clean them.

Before and after

Take the lines "The quick brown fox", "jumps over", "the lazy dog." With "Replace with a space" you get "The quick brown fox jumps over the lazy dog." With "Join lines, keep paragraphs", a blank line between two groups of lines keeps the two paragraphs apart, while the lines inside each group are joined. With "Keep line breaks" plus "Sort lines A to Z" the three lines are put in alphabetical order, one per line.

Tips

If words stick together after joining, you probably chose "Remove completely" when you wanted a space. If hyphenated words were split by a line break in the original, such as "inter-" and "national", check them after joining, because the hyphen stays. Run the result through the word counter if you need to check a length limit.

Frequently asked questions

How do I remove line breaks from text?
Paste the text, leave Line breaks on "Replace with a space", and copy the result. The lines are joined into one block.

How do I keep paragraphs but remove the other breaks?
Choose "Join lines, keep paragraphs". Blank lines stay as paragraph breaks and the lines inside each paragraph are joined.

Why does text from a PDF have so many line breaks?
PDFs store text line by line as laid out on the page. When you copy it, each visual line comes with its own break. Joining the lines fixes that.

Can I sort lines too?
Yes. Choose "Keep line breaks", then pick A to Z, Z to A or reverse order. Sorting treats numbers naturally, so 2 comes before 10.

Is my text sent anywhere?
No. The cleaning runs in your browser and nothing you paste is uploaded or stored.

Advertisement

You might also need