Clean Text Tools

Trim Text

Remove leading and trailing whitespace from whole blocks or each line—choose trim mode when PDF paste adds invisible padding.

Trim Text

Removes whitespace from edges only — spaces inside sentences stay untouched.

Live
Trim mode
0 Leading spaces removed
0 Trailing spaces removed
0 Tabs removed
0 Characters removed
0 Lines trimmed
0 Blank outer lines removed

Paste or type text to trim edge whitespace.

Whitespace Visualizer

space tab nbsp
Whitespace markers appear here when you paste text.
Text with edge padding or tabs
Edge whitespace removed

Your text stays in your browser — nothing is uploaded.

How to Use

  1. Paste text with unwanted spaces at line starts or ends.
  2. Select trim mode: all, each line, or leading/trailing only.
  3. Review tightened output without altering mid-line spacing.
  4. Copy trimmed text for publishing or diffing.

Example

Padded text

   Hello world   
   Second line   

Trimmed per line

Hello world
Second line

Before and After Examples

Primary example

Before

Hello world Second line

After

Hello world Second line

What This Tool Does

Trim Text strips whitespace from the edges of your content according to the selected mode. Per-line trim fixes indented exports; whole-block trim cleans a single string bounded by spaces. It complements Remove Extra Spaces, which targets duplicate gaps inside lines rather than edges.

Guidelines

Tip

Cleaning code paste with accidental leading spaces

Practice

Removing padding from spreadsheet cell exports

Use case

Preparing trimmed strings before slug generation

Note

Fixing YAML or config values with trailing newlines

Common Uses

Best Practices

Paste text with unwanted spaces at line starts …

Select trim mode: all, each line, or leading/tr…

Review tightened output without altering mid-li…

Copy trimmed text for publishing or diffing.

Cleaning code paste with accidental leading spaces

Removing padding from spreadsheet cell exports

Preparing trimmed strings before slug generation

Fixing YAML or config values with trailing newl…

Popular Workflows

Notes & Limitations

All processing runs locally in your browser. Results may vary with edge-case characters or very large inputs.

Frequently Asked Questions

Does trim collapse double spaces mid-line?

No. Use Remove Extra Spaces for internal duplicate spaces.

Are tabs trimmed like spaces?

Yes. Leading and trailing tab characters are removed in trim modes.

Can I trim only the start of lines?

Choose a mode that targets leading whitespace if available in controls.

Will empty lines disappear?

Whitespace-only lines may become empty; use Remove Empty Lines afterward.