Bytelify

Python Formatter

Rescale your Python code's indentation to a consistent width, live as you type.

100% private, runs in your browser
Reindented

Honest about what this does: it rescales your existing indentation to a consistent width — it doesn't parse Python, so it can't fix code that isn't already consistently nested (mixed tabs/spaces at the same level, one-line statements, etc. are outside what it can safely correct). For a full PEP 8 formatter, use a tool like Black locally. Runs entirely in your browser.

What is Python Formatter?

Paste Python code with inconsistent indentation (mixed widths, tabs) and this tool re-expresses it at a consistent 2 or 4 spaces, preserving the nesting your code already has. It's honest about its limits: this doesn't parse Python, so it can't fix code that isn't already consistently structured — for full PEP 8 formatting, use a tool like Black locally.

FAQ

No — this only rescales indentation width based on the nesting already present in your code. It doesn't reflow lines, add blank lines, or enforce any style rules beyond indentation.

It will still rescale the indentation it finds, but since it doesn't parse Python at all, it can't tell you whether the code is syntactically valid.