Text to trim

Trimmed text

How does it work?

This tool removes whitespace characters (spaces, tabs, etc.) from the beginning of each line in your text, while preserving whitespace at the end of lines and between words.

Example of trimming leading whitespace

Original text

   one line   
  two line   
 three line

four line
none   
five line
   six line    

After trimming leading whitespace

one line   
two line   
three line

four line
none   
five line
six line    

This tool is useful for:

  • Removing indentation from code or text
  • Cleaning up text copied from sources with inconsistent leading spaces
  • Preparing text for left alignment
  • Removing leading tabs while preserving trailing whitespace
  • Standardizing the beginning of each line while keeping the rest intact

Note: Unlike the "Trim whitespaces" tool which removes whitespace from both the beginning and end of each line, this tool only removes whitespace from the beginning of each line, preserving any whitespace at the end.

Other tools

See other tools