Text Cleaner — Remove Extra Spaces & Blank Lines
Text cleaner: remove extra spaces, line breaks, blank and duplicate lines and invisible characters — free and runs in your browser.
How it works
- Keep the first exact line match; comparison is case-sensitive.
- Sort lines with the browser’s default locale order.
- Prefix every line with 1. 2. 3. … including blank lines.
- Turn runs of spaces and tabs inside each line into one space and trim both ends.
- Join all non-empty lines into one paragraph separated by single spaces — handy for text copied from PDFs.
- Remove zero-width characters, BOM, and soft hyphens, and turn non-breaking or wide Unicode spaces into normal spaces.
- Sort lines in reverse order (Z to A).
- Keep the first line of each group, ignoring case and surrounding spaces.
About text cleanup
How the text cleaner works
Each mode applies one focused cleanup to the whole text. Trim lines removes spaces at the start and end of every line, and Collapse spaces also squeezes repeated spaces and tabs into one. Remove empty lines deletes blank rows, while Join lines merges broken lines into a single paragraph — useful for text pasted from PDFs, spreadsheets, or chat apps where line breaks do not belong.
Remove duplicates keeps the first exact match, Dedupe (ignore case) also ignores capitalization and surrounding spaces, and Strip invisible chars removes zero-width characters, BOM markers, and soft hyphens while turning non-breaking and other Unicode spaces into normal spaces. Sort lines orders A to Z, Sort Z–A reverses it, and Number lines prefixes every line with 1. 2. 3. … Everything runs locally in your browser.
Text cleanup example
- Messy input
alpha beta alpha beta gamma- Cleaned output
alpha beta alpha beta gamma
Text cleanup FAQ
- How do I remove extra spaces?
- Paste your text and choose Collapse spaces to turn repeated spaces and tabs into a single space and trim every line. Trim lines only removes spaces at the start and end of each line.
- How do I remove duplicate lines?
- Choose Remove duplicates to delete exact repeats and keep the first occurrence, or Dedupe (ignore case) to also treat lines that differ only by capitalization or surrounding spaces as duplicates.
- What invisible characters are removed?
- Strip invisible chars removes zero-width spaces and joiners, the BOM, and soft hyphens, and replaces non-breaking, narrow, and other Unicode spaces with a normal space.
- Is my text uploaded?
- No. Cleaning happens entirely in your browser with JavaScript. Nothing you paste is sent to a server.
- How do I remove line breaks from text?
- Choose Join lines. It joins all non-empty lines into one paragraph with single spaces — handy for text copied from PDFs or emails.
- How do I delete empty lines?
- Choose Remove empty lines. It deletes blank rows, and lines containing only spaces count as empty too and are removed.
- Can I clean text copied from Word or a PDF?
- Yes. Strip invisible chars removes zero-width characters, the BOM and soft hyphens and normalises non-breaking spaces; then Collapse spaces and Join lines fix spacing and broken lines.