Trim Leading/Trailing Spaces Per Line

Paste text to trim leading and trailing spaces from every individual line at once.

Text copied from indented code, a spreadsheet, or a poorly formatted document often carries stray leading or trailing spaces on individual lines, invisible to the eye but capable of causing subtle bugs in code or inconsistent formatting elsewhere.

This tool trims the whitespace from the start and end of every single line in your pasted text simultaneously, leaving the actual line content untouched while removing invisible padding.

This differs from simply trimming the whole block of text (which only affects the very first and last line) — this tool trims every line individually, which matters for multi-line content like code, lists, or CSV-like data.

Because everything runs locally in your browser, results appear instantly and nothing you type or upload is ever sent to a server.

Bookmark this page if you expect to use this tool regularly — it loads fast and behaves the same way every time, with no account needed.

This kind of task shows up constantly in everyday writing, coding, design, and admin work, which is exactly why a dedicated, focused tool saves so much back-and-forth.

A tool that does one job well, without a cluttered interface or unrelated features competing for attention, tends to be faster to use than a heavier all-in-one app.

If you find yourself needing this conversion or calculation often, keeping this page open in a tab is usually faster than digging through a bigger software suite's menus.

Because there's no sign-up or installation step, you can jump straight from search result to working tool in a couple of seconds.

Frequently asked questions

Does this remove blank lines too?

No, this only trims whitespace from the edges of each line; a completely blank line remains blank rather than being removed — use a separate blank-line remover if you want those stripped too.

Will this affect indentation I want to keep, like code indentation?

Yes, this trims all leading whitespace including intentional indentation — it's meant for cleaning up unwanted stray spaces, not preserving code formatting, so use with care on indented code.