Text 55

Trim Leading and Trailing Spaces

Remove unnecessary spaces before and after each line and organize indentation differences.

Input

The example value has been entered. Check it immediately or change the value.

Run with Ctrl or ⌘ + Enter

Input is processed in the browser. Refreshing returns a sample value.

Result

Check or change the value using the example value result.

Up to 50,000 characters. Input and results are processed in this page’s memory and not saved. Line breaks use LF.

Share result

Share the tool link and result text together. No URL is included in the result. Check the below content and then share it.

Calculation·conversion criteria

Removes only spaces from the beginning and end of each line.

Apply trim to each line; keep internal line spaces

Input example

Apple → apple

“A B” surrounded by spaces becomes “A B”. Spaces between words are preserved, and spaces at both ends of each line are removed.

How to use

  1. Use the provided example value or change the text item.
  2. Click Verify result and check the following result.
  3. Result can be copied if needed.

Frequently Asked Questions

Does the consecutive space inside the line also disappear?

Empty lines remain, and internal spaces are preserved. To remove all empty lines, use Remove Empty Lines in sequence. It is also useful for cleaning front/back spaces before comparing duplicate lines.

Calculation criteria and reference materials

The calculation formula and scope of this tool are disclosed in the above description. Examples can be checked by substituting input values into the formula or following the specified string and calendar handling rules.

Verification of calculation criteria: · Calculation·verification principles · Report errors