Black is a free, MIT-licensed formatter for Python code that applies a consistent style based on PEP 8. It reformats whole files in place with a default line length of 88 characters, while offering few style choices. After formatting, it checks whether the abstract syntax tree remains effectively equivalent and raises an error if that check fails. Black installs with pip and requires Python 3.10 or newer. It is primarily a command-line tool and does not provide a Python interface. The documentation lists integrations for editors and IDEs such as PyCharm, Vim, Neovim, Visual Studio Code, Sublime Text, and others, plus GitHub Actions and doctest formatting. Notebook formatting is available with the jupyter extra, but some cells containing certain magics or invalid syntax are skipped. Black also includes blackd, an HTTP server that binds to localhost by default. Stable releases preserve formatting within the same calendar year when the options match. Indentation style cannot be configured.
Who it is for
It suits Python developers who want a consistent formatter in command-line, editor, or GitHub Actions workflows. Notebook users can add the jupyter extra, while accounting for cells Black skips.
What is good
- Free and MIT-licensed.
- Formats entire Python files in place.
- Checks abstract syntax tree equivalence.
- Integrates with editors and GitHub Actions.
- Supports notebook formatting with the jupyter extra.
What to know first
- Requires Python 3.10 or newer.
- Does not provide a Python interface.
- Indentation style cannot be configured.
- Some notebook cells are skipped.
Freedom251 review
Black: the full review
Black is a focused Python formatter with editor and automation integrations, plus a check that reformatted code remains effectively equivalent. Its command-line orientation and fixed indentation style may not suit every workflow.
Black is a Python formatter for developers and teams who want a shared style enforced across files, editors, and automation. It favors predictable formatting over fine-grained control: accept its rules and it can simplify routine style decisions; need custom indentation or a Python library interface and it is a poor fit.
Overview
Black follows PEP 8 and reformats complete files in place, using an 88-character default line length. Its limited style choices are a practical way to reduce formatting debates across a project, but they also mean teams cannot use it to preserve every existing convention. In particular, indentation style cannot be configured.
Black aims to keep diffs small, which can make formatting changes easier to review. It also checks that the reformatted code has an effectively equivalent abstract syntax tree and raises an error if that check fails. Stable releases are intended to produce unchanged formatting across releases in the same calendar year when the same options are used, helping limit style churn within that period.
Key features
- Whole-file formatting: Black applies its style to full files rather than only changed lines. This suits projects seeking uniform output, though it may create a broader formatting change than a changed-lines workflow.
- Editor and automation integrations: Documented integrations cover editors including Emacs, PyCharm and IntelliJ IDEA, Vim, Neovim, Visual Studio Code, and Sublime Text, as well as GitHub Actions, source version control, and doctest formatting. This makes Black usable in both local editing and automated project workflows.
- Notebook formatting: Installing Black with the jupyter extra enables Jupyter Notebook formatting. It skips cells with automagics, non-Python or multiline magics, transformed magic code, or invalid syntax, so notebooks that rely on those cells may not be fully formatted.
- Local service and containers: The included blackd HTTP server binds to localhost by default, and official Docker images are available with release and prerelease tags. These options support local service or container-based workflows without changing Black's command-line orientation.
Pricing
Black is free: its plan costs 0.00 USD per free and is an MIT-licensed open-source Python formatter. There is no paid tier or free trial to weigh against it; the trade-off is functional rather than commercial. Black requires Python 3.10 or newer to run, and it does not provide a Python interface, so teams wanting a library API must choose another approach.
Platforms
Black supports Windows, macOS, and Linux, and can be installed with pip. Its local HTTP server and Docker images extend deployment options, while editor integrations connect it to common development environments. Black promises support for Python versions that have not reached end of life, both for running the formatter and formatting code.
Who it's for
Black is best for Python projects that value a consistent, low-debate style and want formatting integrated into editors or CI. It is less suitable for teams that need configurable indentation, a Python library API, or notebook formatting that handles every kind of magic cell. Its MIT license and zero price also make it straightforward to adopt across projects without a subscription decision.
Pros and cons
- Pro: A consistent style and whole-file formatting reduce project-by-project formatting choices.
- Pro: The abstract-syntax-tree equivalence check can catch a formatting result that is not effectively equivalent.
- Pro: Editor, GitHub Actions, version-control, and doctest integrations support use beyond a standalone command.
- Con: No indentation-style setting means teams cannot adapt Black to a different indentation convention.
- Con: The command-line focus and lack of a Python interface limit use as an imported formatting library.
- Con: Notebook cells using certain magics or invalid syntax are skipped, leaving some notebook content outside its formatting pass.
Alternatives
For a directory of code formatting tools, start with the broader category. Choose Prettier instead if you need a free formatter with API, extension, web, and desktop-platform availability; its listed plan is 0.00 USD per free, with enterprise support and maintenance offered through Tidelift Subscription. Ruff is another free option for readers comparing tools in the Python ecosystem; its maker describes its tools as open source and permissively licensed.
Accessibility Test Framework for Android is a free alternative for readers looking at an Android accessibility test framework rather than a Python formatter. rustfmt is a free formatter option for Rust projects. Biome is a free open-source toolchain for web projects. CSharpier offers free opinionated formatting for C# and XML and installs as a .NET tool. dprint is a free MIT-licensed CLI with self-managed installation. gofmt is a free command-line formatter included with Go.
Verdict
Choose Black if your Python project wants consistent formatting enforced across whole files, with editor and automation integrations and a syntax-equivalence check. Its clearest reason to look elsewhere is the same design choice that makes it dependable: Black does not bend to custom indentation, and it offers no Python library API.
Black plans and pricing
All plansCompared on code formatting tools
- Free plan
- Yes
- Supported languages
- Python
- Supported platforms
- Windows, macOS, Linux, local HTTP API
- Editor integration
- Yes
- Ignore files
- Yes
- Changed-lines formatting
- Yes
- Library API
- No
- License model
- open_source



