Whitespace Cleaner
Runs in your browserTrim trailing spaces, collapse repeated spaces and tabs into one, and optionally remove blank lines — the fastest fix for text pasted out of a PDF or spreadsheet.
About this tool
Text copied from a PDF, spreadsheet, or old document often carries invisible baggage: trailing spaces on every line, doubled-up spaces where formatting used to be, tabs mixed in with spaces. None of it shows up until you paste the text somewhere that treats whitespace literally, like code or a diff. This tool cleans all three problems in one pass.
How to use
- Paste the text you want to clean.
- Choose which cleanup steps to apply — all three are on by default except removing blank lines.
- Run to get the cleaned result.
When to use this tool
- Cleaning text copied out of a PDF before pasting it into code or a document.
- Fixing spreadsheet exports with doubled spaces and trailing whitespace.
- Collapsing blank lines left behind after deleting content.
Tips
- Turn off "collapse spaces" if you're cleaning code where indentation matters — trimming line ends is still safe there.
- Removing blank lines is off by default since paragraph breaks are often intentional.
FAQ
- Will this change my indentation?
- Collapsing spaces reduces any run of spaces/tabs to a single space, which will flatten code indentation — turn that option off if you need to preserve it.
- Is my text sent anywhere?
- No. Cleanup runs entirely in your browser.