Remove Blank Lines & Trim Whitespace
A lightweight text cleanup tool for removing empty lines, trimming stray spaces, and normalising repeated whitespace. Everything runs locally in your browser, nothing is uploaded.
How to use
- Tooltips available on hover for checkboxes and buttons
- Click Copy to copy the result, or the download icon to save it as a .txt file.
What each option does
- Remove blank lines: Deletes every line that is empty or contains only whitespace.
- Merge blank lines: Turns multiple consecutive blank lines into a single one. Great for cleaning up log files or exported reports.
- Trim each line: Strips all leading and trailing whitespace (spaces, tabs, full-width spaces, etc.) from every line, while keeping inner whitespace intact.
- Trim leading/trailing whitespace: Removes all leading and trailing whitespace (spaces, tabs, newlines, full-width spaces, etc.) from the whole text; inner content is left unchanged.
- Remove all whitespace: Removes every whitespace character — half-width/full-width spaces, tabs, line breaks, and other Unicode whitespace (NBSP U+00A0, U+2000–U+200A, U+3000, U+FEFF, etc.); multiple lines are merged into one.
- Remove all spaces: Deletes space characters (U+0020) only. Tabs, line breaks and other whitespace are kept, so the line structure and indentation stay as they are.
FAQ
- Q: Does "Remove blank lines" also strip spaces from non-blank lines?
A: No, it only deletes lines that are fully empty or contain nothing but whitespace. Content lines stay exactly as they are. - Q: What is the difference between "Merge blank lines" and "Remove blank lines"?
A: Merge keeps one blank line between paragraphs (great for readable text), while Remove deletes every blank line. You can run them in sequence — Merge first, then Remove — for the combined effect. - Q: Does it handle all three line-ending styles?
A: Yes — \r\n (Windows), \n (Unix/Linux/macOS) and \r (old Mac) are all recognised and normalised to \n internally.