Free tool

Free text cleaner

This free text cleaner fixes the messy text you get from PDFs, emails, and Word documents in one click. Remove line breaks, collapse extra spaces, delete duplicate or empty lines, sort lines alphabetically, convert smart quotes to straight quotes, and strip HTML tags — all locally in your browser, with nothing ever uploaded to a server.

Text cleaner

Remove line breaks, collapse extra spaces, dedupe and sort lines, fix smart quotes, strip HTML — all in one click, right in your browser.

FreeNo sign-up100% private — runs in your browser
0 characters0 words0 lines

Line breaks

Spaces

Lines

Characters

Case

Every operation runs locally in this browser tab and updates the textarea in place. Use Undo to step back through your last 20 changes. Your text is never uploaded to a server.

Why pasted text turns into a mess

If you have ever copied a paragraph out of a PDF and pasted it somewhere else, you have probably seen this: a sentence that should be one flowing line instead breaks apart after every few words, with a stray line break wherever the PDF happened to wrap the text on the page. That is not a bug in your clipboard — it is how PDF text extraction works. A PDF does not really store “paragraphs”; it stores individual lines of text positioned on a page. When you select and copy that text, most PDF readers copy a literal line break at the end of every visual line, not just at the end of every paragraph. The result is text that looks fine in the PDF but turns into a jagged, hard-to-read mess the moment you paste it into an email, a CRM notes field, a spreadsheet cell, or a content management system.

Email clients cause a similar problem in the other direction. Many email programs — especially older desktop clients and some webmail interfaces — hard-wrap plain-text emails at a fixed line width, often around 72 or 78 characters. That is a holdover from the days of fixed-width terminals, but it still shows up constantly today. Forward a long email chain a few times and you will often see text that has been wrapped, quoted, and re-wrapped so many times that a single sentence is broken into a dozen fragmented lines with stray “>” quote markers in front of each one. Trying to manually delete every one of those line breaks by hand is slow and error-prone — this is exactly the kind of repetitive cleanup a text cleaner tool is built to solve in one click.

The core problem in both cases is the same: a line break that was only ever meant to control how textwrapped visually on a page or in a fixed-width window gets copied as if it were a real, intentional paragraph break. Once you paste that text somewhere else — a place with different margins, a different font, or no fixed width at all — those old line breaks no longer serve any purpose. They just chop your sentences apart. The fix is to strip out the line breaks that do not belong while keeping the ones that do (the real paragraph breaks), which is exactly what the remove line breaks and remove breaks but keep paragraphs buttons above do.

How to remove line breaks from text

  1. Paste your text into the box above — copied from a PDF, an email, a Word document, a spreadsheet cell, or anywhere else.
  2. Choose how you want line breaks handled. Click Remove all line breaks to join everything into one continuous block of text separated by spaces. Click Remove breaks but keep paragraphs if you want to collapse the choppy mid-sentence breaks while still keeping the blank lines between paragraphs.
  3. Clean up what is left. Use Remove empty lines, Collapse multiple spaces, and Trim each line to tidy up any leftover whitespace.
  4. Copy or download the result. Use the Copy button to grab the cleaned text straight to your clipboard, or Download .txt to save it as a plain text file.

Made a mistake, or want to compare before and after? Click Undo to step back through your last 20 changes — every operation is applied in place, so you always have a way back.

Remove all line breaks vs. keep paragraphs — what is the difference?

The two line-break operations solve slightly different problems, and picking the right one matters:

OperationWhat it doesBest for
Remove all line breaksJoins every line — including blank lines between paragraphs — into a single block of text separated by spaces.Single addresses, one-line CSV values, form fields that reject line breaks, or short snippets where paragraph structure does not matter.
Remove breaks, keep paragraphsCollapses the mid-sentence “soft wrap” breaks inside a paragraph into spaces, but leaves a blank line wherever there was already a real paragraph break.Articles, emails, book or PDF excerpts, and any multi-paragraph content you want to keep readable.

If you are not sure which one you need, start with Remove breaks, keep paragraphs — it is the safer default for anything longer than a sentence, since it preserves the structure a reader expects. Reach for Remove all line breaks when you specifically need one continuous line, for example when pasting a value into a spreadsheet cell or a single-line input field.

Word's smart quotes: the copy-paste bug that breaks code

Microsoft Word, Google Docs, and most word processors have a feature called “smart quotes” or “curly quotes” turned on by default. Instead of the plain, straight quote characters (' and ") on your keyboard, these editors silently swap them for typographically “nicer” curly versions — left and right single quotes ( ), left and right double quotes ( ), and matching en dashes and em dashes for hyphens. That looks fine in a printed document or a polished web page.

It becomes a real problem the moment that text gets pasted somewhere that expects plain ASCII characters. Paste a smart-quoted sentence into a block of code, a JSON file, a shell command, a CSV, or a config file, and the curly quote is not the same character the parser is expecting — it is a completely different Unicode code point that just looks similar. The result is a syntax error, a broken string literal, a malformed JSON document, or a command that silently fails, and because the character looks almost identical to a normal quote on screen, it can take a frustratingly long time to spot the actual cause. Anyone who writes documentation in Word, then copies example code or commands out of it, has probably hit this at least once.

The Smart quotes → straight button converts every curly single quote, curly double quote, en dash, em dash, and ellipsis character back into its plain ASCII equivalent — a normal ', ", -, or ... — so the text is safe to paste into code, config files, spreadsheets, or anywhere else that expects plain text rather than typographic punctuation.

A common real-world example: someone writes a setup guide in Word, including a line like const name = "John's file";. Word quietly converts both the double quotes and the apostrophe to their curly equivalents as you type. When a reader copies that line straight into their code editor, it fails to parse — the editor sees a curly opening quote it does not recognize as the start of a string, and the error message rarely points at the real cause. The same thing happens with shell commands, YAML files, and Markdown code fences copied out of a Word doc, a Google Doc, or even some note apps that apply the same “smart” substitution automatically. Running the pasted block through this cleaner first removes the guesswork.

Cleaning scraped or copied text

Text copied from a web page rarely comes through clean. Along with visible characters, it often carries invisible baggage: zero-width spaces used for layout hacks, byte-order marks (BOM) left over from how the source file was saved, non-breaking spaces ( ) that look like a normal space but are not, soft hyphens that only appear at a line break, and bidirectional-text control characters used for right-to-left languages. None of these are visible in a normal text editor, but they can break string comparisons, cause “duplicate” rows in a spreadsheet that look identical but are not, or trip up scripts that expect plain ASCII whitespace.

Scraped or copy-pasted web content also frequently brings its HTML markup along for the ride — stray <span>, <div>, or <p> tags, along with HTML entities like &amp; or &nbsp; instead of the actual characters they represent. The Remove all formatting button strips the invisible non-printable and zero-width characters and normalizes non-breaking spaces to regular ones, while Strip HTML tags removes markup and decodes the most common HTML entities back into normal text. Together they turn a chunk of scraped, invisibly-corrupted web content into clean, plain text you can trust.

Cleaning up lines: dedupe, sort, and reverse

A lot of everyday text cleanup is really about lines, not characters — a list of emails with repeats, a keyword list that needs alphabetizing, or a set of URLs you want ordered shortest to longest. The Lines group handles this without needing a spreadsheet:

  • Remove duplicate lines keeps the first occurrence of each line and drops every repeat — useful for merged email lists, combined keyword exports, or log files with repeated entries.
  • Sort A → Z / Z → A alphabetizes your lines, which is handy for tidying up keyword lists, tag lists, or any list you want to scan quickly or compare against another sorted list.
  • Sort by length orders lines from shortest to longest — useful for spotting outliers, or prioritizing short-tail vs. long-tail keyword variants.
  • Reverse line order flips the whole list, which is a quick way to see the newest entries first in a chronologically-appended log or list.

These line-based operations combine well with the line-break tools above. A typical workflow looks like this: paste a long export, use Remove empty lines to drop the blanks, run Remove duplicate lines to collapse repeats, then Sort A → Z to make the result easy to scan or diff against another list. Because every step is a single click and the undo history keeps up to 20 states, you can experiment freely — try a sort, decide you preferred the original order, and step back with Undo without having to re-paste anything.

Who uses a text cleaner?

  • Writers & editors paste text out of Word or Google Docs and need to remove line breaks and smart quotes before it goes into a CMS or email tool.
  • Developers clean copy-pasted config values, log snippets, and API responses that carry invisible whitespace or curly quotes that break parsers.
  • Marketers & SEOs dedupe and sort keyword lists, or strip formatting from text pulled out of research documents before pasting into a brief.
  • Recruiters & sales teams clean resumes, email lists, and CRM exports of duplicate lines and stray formatting before importing them elsewhere.
  • Students & researchers tidy up quotes and excerpts copied from PDFs and academic papers, where line breaks land in the middle of nearly every sentence.
  • Anyone forwarding old email threads who wants to strip out the accumulated line-wrap mess before quoting a passage somewhere else.

Is this text cleaner safe and private?

Yes. Every operation on this page — removing line breaks, collapsing spaces, deduping lines, converting smart quotes, stripping HTML, changing case — runs locally in your browser using plain JavaScript string processing. Your text is never uploaded to a server, sent to an API, or logged anywhere, which makes it safe to use on drafts, client work, internal notes, or anything else you would not want leaving your machine. It also means there is no file size limit beyond what your browser can comfortably hold, and it keeps working even if your connection drops after the page has loaded.

Frequently asked questions

How do I remove line breaks from text?
Paste your text into the box above and click "Remove all line breaks" to join everything into one line, or "Remove breaks but keep paragraphs" to collapse mid-sentence breaks while keeping blank lines between paragraphs. Both run instantly and update the text in place.
What is the difference between removing all line breaks and keeping paragraphs?
Removing all line breaks joins every line — including paragraph breaks — into one continuous block of text. Keeping paragraphs only collapses the mid-sentence "soft wrap" breaks and leaves the blank lines between actual paragraphs untouched, so longer content stays readable.
Why do smart quotes from Word break my code?
Word and Google Docs automatically replace straight quotes (' and ") with curly "smart" quotes, which are different Unicode characters. Code, JSON, and config files expect the plain straight versions, so pasted smart quotes cause syntax errors. Use "Smart quotes → straight" to convert them back before pasting into code.
Can this tool remove duplicate or empty lines?
Yes. "Remove duplicate lines" keeps the first occurrence of each line and drops repeats, and "Remove empty lines" deletes every blank line, which is useful for cleaning merged lists, exports, and logs.
Is my text uploaded anywhere?
No. Every cleaning operation runs locally in your browser tab using JavaScript. Your text is never sent to a server, so it stays completely private, whether you type it, paste it, or upload a .txt file.
Can I undo a change if I click the wrong button?
Yes. The tool keeps a history of your last 20 changes. Click "Undo" to step back to the text as it was before your most recent operation, one step at a time.

Clean the text, then shorten the link

fewly turns any URL into a short, branded, trackable link — free to start, no credit card.