Normalise whitespace, tabs and line endings

Normalize spaces, tabs, and line breaks while preserving the boundaries you choose.

freeworks offlinenothing uploaded
ToolWhitespace Normalizer
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Runs of whitespace are replaced according to the selected mode, such as one space or trimmed lines. A line-preserving mode handles newlines separately from inline spacing.

  • One-space collapse suits pasted prose.
  • Trim-only mode avoids changing intentional internal spacing.

Worked example

Collapse spaces and trim trailing whitespace
Default options, no tab conversion
Input
											hello   world  
foo		bar  
										
Output
												hello world
foo		bar
											

When to use this

Pasted HTML, copied tables, and logged search queries use whitespace cleanup.

Edge cases

  • Non-breaking spaces are not ordinary spaces.
  • Indentation tabs disappear when every run collapses.
  • Code-block newlines need a preserve-line mode.