Remove line breaks & clean up whitespace
Paste text that wraps every line, is riddled with double spaces, or is full of blank lines, and get back clean text. Join wrapped lines into real paragraphs, collapse repeated spaces, trim every line, drop empty lines, or strip whitespace entirely — pick any combination.
How it works
Six options, each one an independent, composable step. Turn on any subset and they combine in the same fixed order every time, so the result is predictable rather than a guess:
- Trim each line — leading and trailing spaces/tabs removed from every line.
- Remove line breaks — joins lines using whichever separator you pick (below).
- Remove empty lines — drops lines that are blank, or blank after trimming.
- Collapse multiple spaces — runs of spaces/tabs become a single space.
- Remove all whitespace — strips every remaining space, tab and newline outright.
That order is deliberate, not arbitrary. Trim runs before the join so a wrapped line’s leading indent never survives as a stray space in the middle of a sentence. The join runs before empty-line removal because the paragraph-preserving join mode needs your original blank lines to find paragraph boundaries — more on that below. Collapse-spaces runs after the join because joining with a space can itself leave a double space wherever a line already had trailing space, and the collapse step mops that up for free.
The three ways to join lines
| Mode | What it does | Use it for |
|---|---|---|
| Single space | Every newline becomes one space; the whole input becomes one line. | Turning a wrapped sentence or address into one line. |
| Nothing | Every newline is deleted; lines are concatenated directly together. | Data that should have no separator at all, e.g. a code fragment split across lines by a chat client. |
| Keep paragraph breaks | A single newline inside a paragraph becomes a space; a run of one-or-more blank lines is kept as one blank line between paragraphs. | Text copied from a PDF or email where every visual line ends in a real newline, but paragraphs should stay separate. |
Worked example — the PDF-paste problem
This is the single most common reason people land on this tool: text copied out of a PDF, an email client, or a chat export where the layout engine hard-wraps every visual line with a real newline character. Once you paste it into plain text, the layout is gone but the newlines are still there.
This paragraph was copied out of a PDF, so every single line wraps at a fixed width instead of at the end of a real sentence. A second paragraph starts after a blank line like this one, and it wraps the exact same way the first one did.
This paragraph was copied out of a PDF, so every single line wraps at a fixed width instead of at the end of a real sentence. A second paragraph starts after a blank line like this one, and it wraps the exact same way the first one did.
Click Load example above the tool to try this exact text, then toggle “Keep paragraph breaks” against “Join with a single space” to see the difference: the single-space mode collapses the blank line too, giving you one continuous block; the paragraph mode keeps the two paragraphs apart.
What this cannot fix. If the original wrap split a word across a hyphen (“infor-” at the end of one line, “mation” starting the next), joining produces “infor- mation”, not “information”. Telling a real hyphenated compound apart from a wrap artifact reliably needs a dictionary and still gets edge cases wrong, so this tool never guesses — it leaves every hyphen exactly as typed. Check line-end hyphens by hand.
Use cases & limitations
Where this is genuinely useful
- Text copied from a PDF, e-book reader, or scanned document — every line wraps at the page width, and “Keep paragraph breaks” turns it back into normal running prose.
- Email quoting artifacts — forwarded emails often hard-wrap at 72–80 columns; joining with a single space restores normal flow.
- Data pasted from a spreadsheet or form export that has stray blank rows or inconsistent spacing — Remove empty lines and Collapse multiple spaces clean it without touching the actual content.
- Un-wrapping a long code comment written across many short lines, so you can re-wrap it yourself at a different width.
- Stripping accidental whitespace from a value that must have none — an API key, a hex colour, a serial number pasted with a leading space — using Remove all whitespace.
What this tool will not do
- It will not restore words split by a wrap hyphen. See the callout above — that needs a dictionary, not a text transform, and guessing wrong would silently corrupt correct hyphenated words.
- It is not a CSV/TSV-safe row merger. Remove line breaks joins every line in the box, including ones that are meant to stay as separate records. Use a spreadsheet tool for delimited data.
- Trim each line will remove code indentation. It strips leading whitespace from every line, which also deletes meaningful indentation in source code. Use it on prose and data, not on code you plan to keep formatted.
- It only recognises whitespace characters, not layout. A table built with runs of spaces to fake alignment will still lose that alignment once spaces are collapsed — the visual columns were never structural to begin with.
Frequently asked questions
What is the difference between a line break and a paragraph break here?
A line break is any single newline character — often just where a page, column or PDF viewer happened to wrap text, not where a sentence or idea actually ends. A paragraph break is one or more blank lines: a deliberate gap the author put in to separate blocks of text. The “Keep paragraph breaks” option treats the two differently — it turns a lone wrap-newline into a space but leaves a blank-line gap alone, so paragraphs stay separated.
Why does text copied from a PDF still look broken into short lines?
PDFs, and plenty of emails, hard-wrap text at a fixed column width by inserting a real newline character at the end of every visual line, not only where a paragraph ends. Copy that into a plain-text box and the page layout disappears but the newlines stay behind, so what was one paragraph now looks like dozens of separate one-line paragraphs. “Remove line breaks” with “Keep paragraph breaks” turns it back into normal running text.
Will keeping paragraph breaks fix a word that was hyphenated across a line wrap?
No, and this tool does not try to guess at it. If the original wrap split a word with a hyphen (“infor-” / “mation” on the next line), joining the lines with a space produces “infor- mation”, not “information”. Telling a genuine hyphenated compound apart from a wrap artifact reliably needs a dictionary and still gets edge cases wrong, so rather than silently mangling real hyphenated words this tool leaves every hyphen exactly as typed. Check line-end hyphens by hand after cleaning.
What happens if I turn on both Remove empty lines and Keep paragraph breaks?
The options run in a fixed order: joining happens first, so the paragraph-preserving join uses your original blank lines to find paragraph boundaries and reinserts exactly one blank line between paragraphs. Remove empty lines runs after that, and it does not know those blank lines are special — it deletes them too, so the paragraphs end up run together after all. If you want the paragraph gaps to survive, leave Remove empty lines off when you are using Keep paragraph breaks.
Does Collapse multiple spaces also collapse tabs?
Yes. Any run of spaces and/or tabs, in any mixture, becomes a single space — a tab that opens a line and three spaces in the middle of a sentence are both flattened the same way. It only touches horizontal whitespace: it never removes a newline itself, so turning this on by itself does not join your lines. Pair it with Remove line breaks if you also want the line structure gone.
Does Remove all whitespace remove spaces inside sentences too, not just line breaks?
Yes, deliberately — it is the all-or-nothing option. Every space, tab and newline is stripped, wherever it occurs, so “the quick brown fox” becomes “thequickbrownfox”. That is rarely what you want for ordinary prose; it exists for values that must contain no whitespace at all, like a stray space accidentally pasted into an API key, a hex colour or a serial number.
Does this handle Windows line endings (CRLF) the same as Mac or Linux (LF)?
Yes. CRLF, a lone CR and plain LF are all normalised to the same internal newline before any option runs, so text copied from Windows Notepad and text copied from a macOS or Linux editor clean identically. The result you copy out uses plain LF newlines, which is what virtually every modern editor, browser and code tool expects; a small number of strict Windows-only programs prefer CRLF specifically, so re-check in that program if you hit one.
Can I use this on CSV data or source code, not just prose?
It works on any plain text, but think about what each option means for structured data before turning it on. Remove line breaks merges rows together, which is almost never what you want on CSV or TSV — it is built for prose, not delimited records. Trim each line strips leading whitespace, which is exactly what you want for stray trailing spaces but will also delete meaningful indentation in source code. Collapse multiple spaces and Remove empty lines are the two safest to use on code comments or logs.
Do you store or upload the text I paste in?
No. Everything runs in your browser tab — there is no server call, nothing is logged, and what you paste is never uploaded anywhere. Closing or reloading the page clears it; nothing is kept between visits.