Text Trim Tool

Copy-pasted text comes with invisible baggage: trailing spaces at the end of lines, a stray tab in front of a spreadsheet cell, Windows carriage returns hiding after each line. This tool cleans the edges of every line in one pass, stripping the leading and trailing whitespace from each one, so your text looks as tidy as it should when you paste it into a form, an email or a document.

How the trimming works

  1. 1

    Paste your text

    Any size: single lines, paragraphs or columns pasted from a spreadsheet.

  2. 2

    Trim every line

    Each line has its leading and trailing spaces, tabs and carriage returns removed.

  3. 3

    Structure stays intact

    Blank lines and the spacing between words inside a line are left exactly as they were.

  4. 4

    Copy clean text

    One click copies the trimmed result, ready to paste anywhere.

What this tool trims

This tool splits your text into lines and removes whitespace from the start and end of each line. The characters it strips are:

  • Regular space (U+0020)
  • Tab (U+0009)
  • Carriage return (U+000D), the hidden character that Windows adds before each line break

Everything between the first and last visible character of a line is left untouched.

What it does not change

  • Spaces between words. Double or triple spaces inside a line stay exactly as they are. This tool does not collapse them.
  • Blank lines. An empty line stays an empty line; the tool does not delete or merge blank lines.
  • Special spaces. A non-breaking space (U+00A0) or other Unicode spaces pasted from Word or Google Docs are not treated as whitespace here, so they are not stripped.

Common paste problems this fixes

Problem After trim
Lines with trailing spaces Clean line endings
Rows indented with a leading tab or spaces Flush left
Windows carriage returns after each line Removed (clean LF lines)

When not to trim

  • Code: leading whitespace is syntactic (Python, YAML). Do not trim source code with this tool, it destroys indentation.
  • Poetry or typography: extra spaces can be deliberate styling.
  • Fixed-width data: if your data uses leading spaces for alignment, stripping them can break parsing.

Quick notes

  • Trimming cannot be undone here, so keep the original in another tab if you are unsure.
  • The counter tells you how many lines actually changed, so you can see at a glance whether there was hidden whitespace to remove.
  • To also squeeze double spaces inside lines or delete blank lines, run a separate find-and-replace step after trimming.

Frequently Asked Questions

It removes the leading and trailing spaces, tabs and carriage returns from each line. The spacing between words inside a line is left alone.

No. It only trims the start and end of each line. To squeeze runs of spaces inside a line into one, use a find-and-replace with \s+ as a separate step.

Yes, if the code relies on leading indentation (Python, YAML), trimming removes it. Do not run source code through this tool.

Your text is sent to our server to be trimmed and returned to you. We only log how many lines changed, never the text itself, and the text is not stored.

Related Tools

Tool available in other languages