Trim Whitespace
Trim leading and trailing spaces from every line and collapse repeated spaces and tabs.
Runs in your browserText → Text
Loading tool…
Example
hello world foo
hello world foo
How to use the Trim Whitespace
- Paste or type your Text into the input area, or open a file from your device.
- Adjust the options above the editor if the tool offers any.
- Review the Text result, then copy it or download it as a file.
Privacy and limitations
- Your data is processed on your device and is not uploaded to any server.
Related converters
Remove Empty LinesDelete blank and whitespace-only lines from text, logs or code.Remove Line BreaksJoin lines into a single line, optionally keeping paragraph breaks, for pasting copied PDF text.Add Line NumbersPrefix each line with its number, with a choice of format, starting number and padding.Sort LinesSort lines alphabetically, in reverse, naturally (item2 before item10) or by length.Find and ReplaceFind and replace text, with optional regular expressions, capture groups, case sensitivity and whole words.Remove Duplicate LinesDelete repeated lines while keeping the first occurrence and original order, with case options.Text to Slug ConverterTurn titles into clean URL slugs: lower case, accents removed, punctuation replaced by hyphens.Character CounterCount characters with and without spaces, code points, UTF-16 units and UTF-8 bytes for any text.