What is Text Cleaner?
Text Cleaner removes common spacing noise from pasted text. Options can trim the beginning and end of every line, collapse horizontal whitespace within lines, and reduce runs of three or more line feeds to two.
The cleaner first converts Windows CRLF pairs to line feeds. Regardless of the selected options, the final result is trimmed at both ends. It does not repair grammar, join wrapped lines, normalize all Unicode, or identify document structure.
Why Use This Tool?
Text copied from documents, PDFs, chats, and exports often contains trailing spaces, uneven gaps, or too many blank lines. Cleaning those artifacts makes the text easier to edit and paste elsewhere.
- Remove indentation and trailing spaces when line trimming is enabled.
- Turn repeated horizontal whitespace into one ordinary space.
- Limit blank-line runs to a single blank line.
- Normalize common Windows line endings.
How Does This Tool Work?
CRLF sequences become LF first. If trim-lines is enabled, each LF-separated line uses JavaScript `trim()`, which removes leading and trailing Unicode whitespace. If collapse-spaces is enabled, each run matched as non-line-feed whitespace becomes one regular space. This includes tabs and carriage returns that were not part of CRLF.
If collapse-blank-lines is enabled, any run of at least three consecutive line feeds becomes exactly two. Finally, the entire result is trimmed even when line trimming is turned off.
Understanding Your Results
Two consecutive line feeds represent one empty line and are preserved by blank-line collapse. Lines containing spaces may become truly empty if line trimming or space collapsing is enabled, but the blank-line rule only looks at consecutive line feeds at its stage in the pipeline.
Indentation can be meaningful in code, poetry, Markdown, tables, or outlines. Turning on trim-lines or collapse-spaces can damage that structure. The tool offers a preview so options can be evaluated before copying.
Why Tracking This Matters
Clean whitespace improves consistency and prevents accidental formatting differences. Selective cleaning is safer than assuming every extra space is an error, especially with structured or preformatted text.
Benefits of Using Text Cleaner
- CRLF-to-LF normalization
- Optional per-line trimming
- Optional horizontal whitespace collapse
- Optional blank-line reduction
- Live preview
- Local browser processing
How Is the Result Calculated?
The cleaner applies enabled replacements in a fixed order: line-ending normalization, line trimming, horizontal whitespace collapse, blank-line collapse, then unconditional outer trimming.
CRLF normalize → selected cleanup options → trim whole result
- Horizontal whitespace
- Whitespace other than line feed.
- Blank-line run
- Three or more consecutive line feeds.
Tips for Better Results
- Disable line trimming for code or intentional indentation.
- Disable space collapse when tabs or aligned columns matter.
- Use Remove Line Breaks if the actual goal is joining wrapped lines.
- Compare the preview with the source before copying.
- Keep an original copy of structured text.
Conclusion
Text Cleaner handles common whitespace problems with three focused options. Review structured content carefully, because indentation and repeated spaces can carry meaning.