---
title: "Whitespace Cleaner"
description: "Clean up whitespace in pasted text. Trim the ends, collapse runs of spaces and tabs, remove blank lines, and normalize Windows line endings. Runs in your browser, no signup."
url: https://findutils.com/text/whitespace-cleaner/
category: text
---

# Whitespace Cleaner

Clean up whitespace in pasted text. Trim the ends, collapse runs of spaces and tabs, remove blank lines, and normalize Windows line endings. Runs in your browser, no signup.

**Use this tool:** [Whitespace Cleaner](https://findutils.com/text/whitespace-cleaner/)

## Programmatic access

- REST id `whitespace-clean`: POST https://api.findutils.com/api/tools/whitespace-clean/execute (reference: https://findutils.com/api/whitespace-clean/)
- MCP tool `whitespace_clean` on https://mcp.findutils.com (reference: https://findutils.com/mcp/whitespace-clean/)

## Why use a whitespace cleaner?

Text copied from a PDF, a web page, a spreadsheet, or a chat window carries spacing you did not write: double spaces after a paste, tabs where a table used to be, blank lines between every paragraph, and Windows line endings that show up as ^M in a Unix editor. Fixing that by hand means a long series of find-and-replace runs. The Whitespace Cleaner applies the four common fixes in one pass and shows you how many characters it removed, so you can paste the result into a document, a form, or a script with confidence.

## Frequently Asked Questions

### What does the Whitespace Cleaner change?

It applies up to four fixes, and each one is a toggle. Trim removes whitespace before the first character and after the last one. Collapse spaces turns every run of spaces and tabs inside a line into one space. Remove blank lines drops lines that hold only whitespace. Normalize line endings converts CRLF and CR to LF. It does not change letters, punctuation, or the order of your lines.

### Does it remove the indentation from code?

Yes, when Collapse spaces is on. That option turns leading tabs and spaces on each line into one space, which breaks Python and YAML. Turn Collapse spaces off to keep indentation and still trim the ends, remove blank lines, and normalize line endings.

### Does it remove non-breaking spaces?

Yes. Collapse spaces treats a non-breaking space (U+00A0) and the other Unicode space characters as whitespace, so a run of them becomes one regular space. Trim removes them at the ends of the text as well.

### What is the difference between CRLF and LF?

CRLF is the two-character line ending Windows writes. LF is the one-character line ending used by Linux, macOS, Git, and most web tooling. A file that mixes the two shows stray ^M marks in some editors and produces noisy diffs. Normalize line endings converts every CRLF and every lone CR to LF.

### Is there a size limit?

The page has no fixed limit; your browser's memory is the ceiling, and a very large paste takes a moment to process. The REST and MCP surfaces cap one request at 1 MB.

### Does the Whitespace Cleaner require a signup?

No. It is available with no signup and no usage limits. The cleaning runs in your browser, so the text you paste is not uploaded to a server.

### Can I run the same cleanup from a script or an AI client?

Yes. The same function powers the REST endpoint at api.findutils.com and the MCP server at mcp.findutils.com, as the REST tool whitespace-clean and the MCP tool whitespace_clean. The four options are the same arguments: trim, collapse_spaces, remove_blank_lines, and normalize_newlines.

### Does it remove trailing spaces at the end of each line?

Collapse spaces reduces trailing spaces on a line to a single space. It does not remove that last space on its own. To remove every trailing space, use the Find & Replace tool in regex mode with the pattern [ \t]+(?=\n|$) and an empty replacement.

### Will it change the text inside quotes or code blocks?

Yes. The tool applies each fix to the whole input. It does not detect quotes, Markdown, or code fences. Clean those sections separately if their spacing matters.

### Why does the character count drop more than I expected?

Each CRLF line ending counts as two characters and becomes one after normalization, so a Windows file with 500 lines loses about 500 characters from that step alone. Tabs, double spaces, and blank lines add to the total.

## Related Tools

- [Text Find & Replace](https://findutils.com/text/text-find-replace/)
- [Duplicate Line Remover](https://findutils.com/text/duplicate-line-remover/)
- [Text Line Sorter](https://findutils.com/text/text-line-sorter/)
- [Case Converter](https://findutils.com/text/case-converter/)
- [Character Counter](https://findutils.com/text/character-counter/)
- [Word Counter](https://findutils.com/text/word-counter/)
- [HTML to Markdown](https://findutils.com/convert/html-to-markdown/)
- [Diff Checker](https://findutils.com/text/diff-checker/)
