How to Use Remove Leading Trailing Spaces: Steps and a Worked Example

By 1 min read

Trim spaces from the start and end of every line. This guide shows what to enter, a worked example, and the limits to keep in mind. The Remove Leading Trailing Spaces tool is free, needs no account and runs in your browser.

What you need

  • Text

Step by step

  1. Open the Remove Leading Trailing Spaces tool.
  2. Fill in Text.
  3. Read the result, which updates as soon as the inputs change.

Worked example

the tool returns:

first line
second line
third line

How it works

Paste text. Leading and trailing spaces and tabs are removed from each line; spaces inside lines are kept.

Things to keep in mind

Check your inputs, units and any local rules before you rely on the result.

If this is not quite what you need, try Remove Extra Spaces, Remove Duplicate Lines or Remove Emoji from Text.

More from the blog