— Trim Text

Trim Text Tool - Remove Leading and Trailing Whitespace

Quick Tips

  • This tool runs entirely in your browser - your data stays private.
  • Press Ctrl+V (Cmd+V on Mac) to quickly paste text.
  • Use the Copy button to save your result to clipboard.
  • Bookmark this page for quick access!

Remove leading and trailing whitespace from text and lines.

Examples

Input
   Hello World   
Output
Hello World
Input
		Tabbed content		
Output
Tabbed content
Input
   Line 1   
   Line 2   
   Line 3   
Output
Line 1
Line 2
Line 3
Input
   Only left side
Output
Only left side
Input
Only right side   
Output
Only right side

Frequently Asked Questions

Trimming only removes whitespace from the beginning and end of text, leaving internal spacing intact. Removing all spaces eliminates every space throughout the entire text.

You can choose either mode. Full trim treats the entire input as one block. Line-by-line trim processes each line independently, removing leading and trailing spaces from every line.

The tool removes regular spaces, tabs, non-breaking spaces, and other whitespace characters. When trimming the full block, leading and trailing newlines are also removed.

Yes, you can select left trim (leading whitespace only), right trim (trailing whitespace only), or both. This gives you precise control over what gets removed.

Yes, this performs the same operation as trim(), ltrim(), and rtrim() functions found in most programming languages, but with an easy visual interface.

Line-by-line trim preserves all line breaks. To remove empty lines, use our Empty Line Remover tool which is designed specifically for that purpose.

Cookie Preferences

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.

Cookie Preferences

Manage your cookie settings

Essential Cookies
Always Active

These cookies are necessary for the website to function and cannot be switched off. They are usually set in response to actions made by you such as setting your privacy preferences or logging in.

Functional Cookies

These cookies enable enhanced functionality and personalization, such as remembering your preferences, theme settings, and form data.

Analytics Cookies

These cookies allow us to count visits and traffic sources so we can measure and improve site performance. All data is aggregated and anonymous.

Google Analytics _ga, _gid

Learn more about our Cookie Policy