Line trimmer
Remove unwanted whitespace from the edges of every line.
How to use the Line trimmer
What does the Line trimmer do?
Remove leading spaces, trailing spaces or both from every pasted line without collapsing spacing inside the line; It applies this page-specific rule: each line is processed independently.
Which inputs does this tool use?
To remove leading spaces, trailing spaces or both from every pasted line without collapsing spacing inside the line, enter Input text, Trim, Output; keep every value in the same example; where available, choose between Both edges, Leading only, Trailing only to match the required format; select Process text when the values are ready; Start with a familiar case covered by this rule - Internal spacing is left untouched, so aligned words and repeated spaces within a line remain - so the expected result can confirm the settings.
How should the tool result be read?
For a result intended to remove leading spaces, trailing spaces or both from every pasted line without collapsing spacing inside the line, internal spacing is left untouched, so aligned words and repeated spaces within a line remain; read output together with the original input text rather than as an isolated answer, and confirm that its units or structure match the intended use.
Can I remove trailing spaces but keep indentation?
When the goal is to remove leading spaces, trailing spaces or both from every pasted line without collapsing spacing inside the line, yes.
Are empty lines removed?
When using the page to remove leading spaces, trailing spaces or both from every pasted line without collapsing spacing inside the line, no.
Limits and accuracy
When using this tool to remove leading spaces, trailing spaces or both from every pasted line without collapsing spacing inside the line, use trailing-only mode for source files where indentation matters; check the result in its intended destination before relying on it for important work; keep input text until the output has been checked in its intended destination.
How line trimmer works
Each line is processed independently. Leading mode removes whitespace before the first visible character, trailing mode removes it after the last visible character, and both mode applies both rules.
Internal spacing is left untouched, so aligned words and repeated spaces within a line remain. Blank lines are preserved as blank lines rather than deleted.
Use trailing-only mode for source files where indentation matters. Use both edges for pasted lists or exports where indentation has no useful meaning.
Frequently asked questions
Can I remove trailing spaces but keep indentation?
Yes. Choose trailing only; whitespace at the start of each line will remain unchanged.
Are empty lines removed?
No. Empty lines remain in the same position, although whitespace on those lines is trimmed according to the selected mode.
Does it collapse spaces inside a sentence?
No. It only operates at the beginning and end of each line.