EditSafely

Trim List Items

Remove whitespace characters around list items.

Runs on your device, nothing uploaded

Trim
Try:

0 chars · 0 lines

Output

Remove whitespace characters around list items.

Type or paste above to see the result here.

Example: Trim every item

What you paste never leaves this tab

Trim List Items is JavaScript that your browser has already downloaded, and it does the whole job on your own machine. On a normal site, the text you paste is sent to a server that can log it, cache it or keep it. Here it is read and transformed inside this tab and nowhere else.

  • No upload
  • No length limit
  • Works offline once loaded
  • Nothing stored or logged

How to use Trim List Items

  1. 1. Paste your list. Enter your items into the input pane, one per line, including any leading or trailing spaces currently around each item.
  2. 2. Choose which side to trim. Pick Both to strip whitespace from either end of every item, or Start or End if the extra spaces only appear on one side. Non-breaking and zero-width spaces count too.
  3. 3. Collapse inner spaces if needed. Under More options, Collapse inner spaces turns runs of spaces and tabs inside an item into one space. Show whitespace in the result draws spaces as dots and tabs as arrows.
  4. 4. Copy the trimmed list. The output pane shows your list with the extra whitespace removed from each item. Copy the cleaned-up result wherever it is needed.

When to use Trim List Items

Trim List Items removes extra spaces or tabs from around each entry in a list. Use Trim List Items whenever pasted data has inconsistent leading or trailing whitespace that is throwing off comparisons or formatting.

  • Fixing indentation from a copied spreadsheet. Cells copied from a spreadsheet sometimes carry leading spaces into a plain text list. Trimming both sides removes that indentation before you compare or sort the items.
  • Cleaning up form input with stray spaces. Users often type extra spaces before or after their entries in a form. Trimming every item ensures a value like ' apple' matches 'apple' when you compare entries.
  • Removing trailing spaces before a diff. A list needs to be compared against a previous version, but trailing whitespace on some lines would create false differences. Trimming the right side clears that noise first.
  • Normalizing spacing after a mixed-format paste. A list assembled from multiple sources has inconsistent spacing, some items padded and some not. Trimming every item brings them all to the same clean baseline.

Examples

Trim every item

Input

  milk  
	eggs 
 bread

Output

milk
eggs
bread

Collapse inner spaces too

Input

 red   apples 
 green  pears

Output

red apples
green pears

About the Trim List Items tool

Trim List Items is a free online tool that works entirely inside your web browser. Remove whitespace characters around list items. Because the processing happens on your own device, nothing you enter is uploaded, logged or stored anywhere.

This page is one of 114 List utilities on EditSafely. Each one does a single job well, and all of them follow the same rule: your input stays on your machine.

You can shape the output with 2 settings, including Trim and Collapse inner spaces, and the result refreshes the moment you change one. 2 worked examples further down the page show exactly what the tool produces for real inputs.

Because nothing leaves your device, the tool is suitable for sensitive content such as internal documents, credentials or customer data. It also responds instantly, since every step is handled on your own machine rather than by a remote API.

Frequently asked questions

Is Trim List Items free to use?

Yes, it is completely free. All 2,943 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.

How much text can I process at once?

There is no fixed limit; your device's memory is the ceiling. Up to 10 MB the result updates as you type, after a short pause that grows with the size. Above 10 MB a Run button appears so typing stays smooth, and files open up to 50 MB. A very long result shows its first 2,000 lines on screen, while Copy and Download always include all of it.

Do I need to sign up or install anything?

No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.

Related tools

All List Tools →