Jump to a tool

Text cleanup

Trim Whitespace

Remove invisible padding while keeping meaningful line breaks and indentation under control.

Processed locally in your browser. Your data is never uploaded or stored.
Processed locally in your browser. Your data is never uploaded or stored.

Ready

Input0 lines · 0 characters
Output0 lines · 0 characters
OptionsAdjust how this tool processes your text
Trim Whitespace options
Press Ctrl/Cmd + Enter to process

What this tool does

A focused tool for a specific cleanup job

Trim Whitespace can clean each line independently, strip only one side, remove outer padding from the whole document, or preserve indentation while still removing trailing spaces.

Common use cases

  • Fix trailing spaces before a code review
  • Clean columns copied from spreadsheets
  • Normalize values before comparison
  • Keep code indentation while removing line-end padding

How to use Trim Whitespace

  1. Paste the padded text.
  2. Select line trimming, whole-text trimming, or one-sided cleanup.
  3. Enable indentation preservation for code or nested lists.
  4. Inspect the output and copy it.

Options explained

  • Trim each line removes whitespace on both sides of every line.
  • Trim entire text touches only the outer boundary of the full paste.
  • Preserve indentation prevents leading whitespace from being removed.
  • Trailing-only cleanup is safe for indented content.

Example

Before
  first  
    second  
After
first
second

Edge cases and limitations

  • Tabs are treated as whitespace.
  • Preserved indentation may contain a mix of tabs and spaces.
  • Blank lines remain unless another option removes them.

Questions

Trim Whitespace FAQ

Can I remove trailing spaces without changing indentation?

Yes. Enable trailing-space removal and preserve indentation.

Does trimming remove line breaks?

No. Line structure is preserved unless outer blank space is part of whole-text trimming.