Trim whitespace
Trim leading, trailing, or both sides of whitespace on every line or around the entire text.
How it works & useful details
How to use this tool
Choose each line to remove indentation or trailing spaces line by line. Choose whole text to trim only the outer boundaries, preserving interior whitespace and line endings.
How the result is calculated
Uses JavaScript trim rules, including tabs, line breaks, nonbreaking spaces, and U+FEFF. It preserves zero-width space U+200B. Each-line mode preserves the number of lines and normalizes CRLF and CR to LF; it does not remove blank lines.
Up to 500,000 UTF-16 code units per input. Text stays on your device.
