Skip to content

Left Align Text

Strip indentation so every line starts at the left margin.

Quick Tool Overview

Left Align Text strips the leading whitespace that a block picks up from wherever it was copied. Flat mode removes all of it; relative mode removes only the amount every line shares, which keeps the internal nesting of a code block intact.

What it does
Removes leading whitespace from every line
You give it
A block copied from a PDF, slide, email or editor
You get back
Text starting at the left margin
Best for
Cleaning pasted blocks and outdenting code
Text Tools Free, unlimited use No sign-up Runs in your browser

About the Left Align Text

Text copied out of a PDF, a slide deck or an indented code block arrives carrying the indentation of wherever it came from. Every line starts a few characters in, the block no longer aligns with anything around it, and removing it by hand means editing every line.

This strips the leading whitespace from every line in one pass. There are two useful modes. Flat removes all indentation so every line starts hard against the margin. Relative removes only the common indentation shared by every line — which is what you want for a code block copied out of a function, where the nesting inside it still matters and only the outer indentation should go.

Key features of the Left Align Text

Relative mode keeps nesting

Only the shared indentation is removed, so a function copied out of a class still has its structure.

Tabs measured properly

A tab counts as a configurable number of columns, so mixed indentation is handled consistently.

Line breaks untouched

Only the start of each line changes — nothing is joined together.

Whitespace-only lines emptied

A line of spaces becomes genuinely empty, clearing invisible whitespace at the same time.

Optional end trimming

Trailing whitespace can go in the same pass, which is usually wanted alongside.

How to use the Left Align Text

  1. 1

    Paste the indented text

    A block copied from a PDF, a slide, an email or a code editor.

  2. 2

    Choose flat or relative

    Flat removes all indentation; relative removes only the amount every line shares.

  3. 3

    Handle trailing space too

    Optionally trim the ends of lines in the same pass.

  4. 4

    Copy the aligned text

    Every line now starts where you expect it to.

Frequently asked questions

Code. A function copied out of a class carries four or eight spaces of outer indentation on every line, while the nesting inside it is meaningful. Relative mode removes the shared amount and keeps the structure.

Reviews of the Left Align Text

What people who use the Left Align Text think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the Left Align Text. It takes half a minute and no account.

Write the first review

More text tools