Only whitespace is rewritten: indentation is re-levelled and long lines can be wrapped, while strings, comments and operators are copied byte for byte. This is a layout formatter, not a linter — it does not check or repair syntax.
Runs locally in your browserPaste a Python snippet and the tool returns the same program with re-levelled indentation, a blank-line policy and optional line wrapping. Only whitespace between tokens is rewritten: strings, comments and f-string braces are copied through byte for byte, so the result parses to the same syntax tree as the input.
The formatter runs entirely in this browser tab and nothing is uploaded. It is a layout formatter, not a linter: it does not check, compile or repair Python, and it never reports an error, so a broken snippet comes back laid out rather than fixed.
Only whitespace between tokens is rewritten: leading indentation is re-levelled to the chosen unit, trailing spaces and surplus blank lines are removed, and long lines can be wrapped. Everything else is copied byte for byte — single and double quoted strings, raw, bytes and f-strings (including braces with nested quotes), triple-quoted strings and docstrings with the indentation inside them, comments, and operators such as **, //, :=, -> and the * and ** used in calls and unpacking.
A quick check on any result: the output holds the same tokens in the same order as the input, only re-spaced. If the code also goes through Black, Ruff or autopep8 in your editor, this page does not replace that pass — it is for reading a snippet, not for a build step.
Each deeper indent step in the input becomes one unit of the selected width, so tabs, 2, 3, 4 and 8 spaces all produce a consistent block structure, and a file that mixes styles is normalised to the unit you pick. Lines that continue an unfinished statement — inside brackets or after a backslash — keep their offset relative to the statement they belong to.
The blank-line setting caps runs of empty lines: remove them, keep at most one or two (the default keeps two, the usual spacing around top-level definitions), or keep all of them. Wrapping is greedy and only breaks at whitespace outside strings and comments, so a token is never split; when a single long string or name cannot be broken, the line stays long instead of being cut.
It is not a linter, a style fixer or an interpreter. Nothing is executed, no names are renamed, imports are not sorted, quotes are not converted, and a missing colon or an unclosed bracket is not reported. Lines the author split are kept as they are, apart from their indentation.
Because the program is never parsed, the page cannot tell you that the input is invalid: mixed tabs and spaces, for instance, are normalised rather than reported. Run the result through python -m py_compile or your editor's checker when you need to know that it is valid.