Text Trim

Trim whitespace from text — strip leading, trailing, or both sides, per line or whole block.

About Text Trim

Trimming removes whitespace (or other specified characters) from the beginning and/or end of strings. It is one of the most frequently used string operations in programming — virtually every language has a built-in trim function: PHP's trim(), JavaScript's trim(), Python's strip(), Java's String.strip(), etc.

This tool applies trimming per-line (cleaning up each line of a multi-line text independently) or to the whole block (removing only the whitespace before the very first character and after the very last character). The custom characters option lets you strip characters other than whitespace, similar to PHP's trim($str, "characters") or Python's str.strip("characters").

FAQ

What does ltrim and rtrim mean?
ltrim (left trim) removes whitespace only from the beginning (left side) of a string. rtrim (right trim) removes whitespace only from the end (right side). The plain trim() or strip() removes whitespace from both sides simultaneously.