Trim Whitespace

Paste text below to strip spaces and tabs from the start and end of every line. Nothing else in your text changes.

  • Free, no sign-up
  • Runs in your browser

Drop your file here, or

TXT, CSV, JSON, Markdown, HTML, XML, DOCX, PDF, RTF and more

Type, paste with Ctrl V, or drop a file

Options

or press Ctrl EnterRuns in your browser

Result

Your cleaned text will appear here.

Add your text, then press Trim whitespace.

How to use Trim Whitespace

  1. Paste your text into the input box.
  2. Choose what to trim: leading whitespace, trailing whitespace, and empty lines at the start and end.
  3. Optionally normalize Windows (CRLF) line endings and convert non-breaking spaces to regular spaces.
  4. Copy or download the result. The stats show how many characters were removed.

Example

Before
   Apple  
	Banana
Orange   
After
Apple
Banana
Orange

Leading and trailing spaces and tabs are removed from each line.

Good for

  • Cleaning values before pasting them into a spreadsheet or database
  • Removing trailing spaces that cause diffs in code reviews
  • Fixing text copied from websites that contains non-breaking spaces

What happens to your text

Your text is processed in your browser and kept only in this tab’s memory. It is not uploaded, saved or used for analytics.

Questions about Trim Whitespace

More answers in the TextVix FAQ.

What is the difference between trimming and removing extra spaces?

Trimming only removes whitespace at the start and end of each line. Remove Extra Spaces collapses repeated spaces inside lines into one.

What does “normalize line endings” do?

It converts Windows (CRLF) and old Mac (CR) line breaks into standard LF line breaks, so every line ends the same way.

Is my text uploaded anywhere?

No. This tool runs entirely in your browser. Your text and files are never sent to a server or stored.