Trim Leading & Trailing Spaces

Trim whitespace from the beginning and end of each line in the text. Interior spacing is preserved.

Example

Input

  Hello World  
   Line Two   
  Line Three  

Output

Hello World
Line Two
Line Three

How Trim Leading & Trailing Spaces Works

Trim whitespace from the beginning and end of each line in the text. Interior spacing is preserved.

This tool runs entirely in your browser — no data is sent to any server. Paste your text, click Run, and get your result instantly. You can also chain this tool with others using the pipeline feature: run Trim Leading & Trailing Spaces, then continue with a related tool to build a multi-step text workflow.

TextRefinery is a free, open-source text processing toolkit. Learn more about regular expressions and text processing on the web.