You want a tool that's not configurable and is very opinionated, because you and anyone else that ever touches the codebase can set up a commit hook to run that tool over the whole project and you never have to think about it again. I'm telling you, formatting is not an aesthetic consideration. Stick with the strictest pep8 compatible formatter you can find. As for indent, use a tab character and configure your editor to display it as 2 spaces Edit: to clarify, strict as in as few choices left to the developer as possible. Pep8 compatible as in implements most of pep8, but that's secondary to the first point. Arguments about spaces vs tabs are the reason for my first point: that's not a conversation you have to have if your formatter just does it. Answer from cyberjellyfish on reddit.com
๐ŸŒ
Code Beautify
codebeautify.org โ€บ python-formatter-beautifier
Python Formatter and Beautifier
Python Beautifier Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari.
๐ŸŒ
Minifier
minifier.org โ€บ python-beautifier
Python Beautifier - Format & Beautify Python Code Online
Python beautifier is a free online tool that automatically formats messy, unindented, or hard-to-read Python code into a clean, consistent format. It follows PEP8, the official Python style guide, to ensure best practices in code readability.
Discussions

Easy, free to use online formatter for Python code with configuration options?
You want a tool that's not configurable and is very opinionated, because you and anyone else that ever touches the codebase can set up a commit hook to run that tool over the whole project and you never have to think about it again. I'm telling you, formatting is not an aesthetic consideration. Stick with the strictest pep8 compatible formatter you can find. As for indent, use a tab character and configure your editor to display it as 2 spaces Edit: to clarify, strict as in as few choices left to the developer as possible. Pep8 compatible as in implements most of pep8, but that's secondary to the first point. Arguments about spaces vs tabs are the reason for my first point: that's not a conversation you have to have if your formatter just does it. More on reddit.com
๐ŸŒ r/learnpython
24
3
July 13, 2024
Is there something like prettier for python?
There's probably no such thing as "perfect", but there are programs like " black " that ensure the code is formatted "correctly". More on reddit.com
๐ŸŒ r/learnpython
23
12
April 7, 2024
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ online_python_formatter.htm
Online Python Formatter | Tutorialspoint
Online Python Formatter and Beautifier - Try online Python Code formatter and beautifier and Editor to beautify and format Python code using jQuery Plug-in
๐ŸŒ
Prettier
prettier.io
Prettier ยท Opinionated Code Formatter ยท Prettier
PRETTIER FOR ENTERPRISE ยท Try It OnlineInstall Prettier ยท Limited edition tshirts are now available to buy! $10 per tshirt goes to maintain the project. An opinionated code formatter ยท Supports many languages ยท Integrates with most editors ยท Has few options ยป ยท
๐ŸŒ
Formatter.org
formatter.org โ€บ python-formatter
Python Formatter Online โ€“ Beautify and Format Python Code
Beautify and format Python code online to improve readability, fix indentation, and keep formatting consistent.
๐ŸŒ
Pyrfecter
pyrfecter.com โ€บ format-python-code
Format Python code online ยท Pyrfecter
June 26, 2025 - If you have Python code you want to format online, look no further. Pyrfecter is an easy and secure way to format, lint, and improve your Python code all from inside your browser. Even if your code is well written Pyrfecter can help.
๐ŸŒ
CleanCSS
cleancss.com โ€บ python-beautify
Python Viewer, Formatter, Editor
Enter your messy, minified, or obfuscated Python into the field above to have it cleaned up and made pretty. The editor above also contains helpful line numbers and syntax highlighting. There are many option to tailor the beautifier to your personal formatting tastes ยท Often when writing Python ...
Find elsewhere
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ easy, free to use online formatter for python code with configuration options?
r/learnpython on Reddit: Easy, free to use online formatter for Python code with configuration options?
July 13, 2024 -

I am searching for a formatter for Python3 which takes a few simple styling parameters and yet is very easy to use. All I found so far where tons of formatters, which ansolutely enforce one and only one formatting style.

Example input:

def deleteSubnet(ipAddress, cidrMask, interface = defaultNetworkInterface):
    if subprocess.run(["ip","a","d",ipAddress+"/"+cidrMask,"dev",interface], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode != 0:
        quit(color.red+" ERROR:"+color.stop+" IP could not be cleared. You need to manually remove "+color.blue+ipAddress+"/"+cidrMask+color.stop+" from "+color.blue+interface+color.stop+"!!! Terminating...")
    print(color.green+" Success: deleted IP "+color.stopcolor.blue+ipAddress+"/"+cidrMask+color.stop+" from interface "+color.blue+interface+color.stop+".")

Example output (NOT WANTED):

def deleteSubnet(ipAddress, cidrMask, interface=defaultNetworkInterface):
    if (
        subprocess.run(
            ["ip", "a", "d", ipAddress + "/" + cidrMask, "dev", interface]
            stdout=subprocess.DEVNULL,
            stderr=subprocess.DEVNULL,
        ).returncode
        != 0
    ):
        quit(
            color.red
            + " ERROR:"
            + color.stop
            + " IP could not be cleared. You need to manually remove "
            + color.blue
            + ipAddress
            + "/"
            + cidrMask
            + color.stop
            + " from "
            + color.blue
            + interface
            + color.stop
            + "!!! Terminating..."
        )
    print(
        color.green
        + " Success: deleted IP "
        + color.stopcolor.blue
        + ipAddress
        + "/"
        + cidrMask
        + color.stop
        + " from interface "
        + color.blue
        + interface
        + color.stop
        + "."
    )

Yes it is ugly. Does not matter. If reddit does word-wrap the lines, it will be horrible. But if the line just overflows, it just looks great for me.

All I want to do is a simple tool that understands the indentations and allows me to configure a target indentation. I do not care for the standard that tools like pylint try to enforce - i dislike it.

However what is way worse than not breaking lines, is uneven indentations. And that I need to fix - but please not manually. Is there an easy to use tool, that can fix my *variable* indentations to exactly 2 spaces per indent without changing the rest of the content of the lines? (yes I want 2 spaces, period)

For javascript there are amazing tools, like beautifier.io which handles it perfectly. Why can't I find something like that for python? And yes, I prefer a simple online tool actually, that does not require a login or download.

As to why it is uneven: It is a copy&paste collection from different sources.

Thanks for your help.

๐ŸŒ
Vercel
black.vercel.app
Black Playground
Playground for Black, the uncompromising Python code formatter.
๐ŸŒ
ExtendsClass
extendsclass.com โ€บ python-formatter.html
Python formatter online
This Online Python formatter allows to easily format unformatted or ugly Python code.
๐ŸŒ
Testmuai
testmuai.com โ€บ home โ€บ free tools โ€บ python formatter & beautifier online
Python Formatter & Beautifier Online | TestMu AI
The TestMu AI Python Beautifier is a free online tool that helps developers format and beautify their Python code, making it more readable and maintainable.
๐ŸŒ
CloudDefense.ai
clouddefense.ai โ€บ tools โ€บ code-formatter โ€บ python
Best Python Code Formatter Tool Online
Protect your Applications & Cloud Infastructure from attackers by leveraging CloudDefense.AI ACS patented technology ยท 579 University Ave, Palo Alto, CA 94301
๐ŸŒ
Online Python
online-python.com โ€บ uJYg8RbGHU
Online Python - IDE, Editor, Compiler, Interpreter
Build and Run your Python code instantly. Online-Python is a quick and easy tool that helps you to build, compile, test your python programs.
๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ python โ€บ formatting
Formatting Python in VS Code
November 3, 2021 - Note: If you don't find your preferred formatter listed above, you can add support via an extension. The Python Extension Template makes it easy to integrate new Python tools into VS Code.
๐ŸŒ
DEV Community
dev.to โ€บ eegli โ€บ quick-guide-to-python-formatting-in-vs-code-2040
Quick Guide to Python Formatting in VS Code (2025) - DEV Community
February 1, 2025 - If you find this config in your settings, you've found the reason why autopep8, black or yapf are not working - The above configuration will choose Prettier to format Python, which is not supported.
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ pycharm โ€บ prettier.html
Prettier | PyCharm Documentation
November 24, 2025 - Prettier is a tool to format files in various languages, like TypeScript, JavaScript, CSS, HTML, JSON, and others. With PyCharm, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier action.
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ pprint.html
pprint โ€” Data pretty printer
The pprint module provides a capability to โ€œpretty-printโ€ arbitrary Python data structures in a form which can be used as input to the interpreter. If the formatted structures include objects which are not fundamental Python types, the ...
๐ŸŒ
GitHub
github.com โ€บ prettier โ€บ plugin-python
GitHub - prettier/plugin-python: Prettier Python Plugin
October 1, 2019 - Prettier Python Plugin. Contribute to prettier/plugin-python development by creating an account on GitHub.
Starred by 521 users
Forked by 37 users
Languages ย  JavaScript 72.2% | Python 27.8%