Skip to content
SPECIFICTION
Get listed

Black

black.readthedocs.io

Free plan WindowsmacOSLinuxSelf-hosted

What it is

Black is a free, MIT-licensed formatter for Python code that follows PEP 8. It reformats whole files in place and uses a default line length of 88 characters. Its limited style choices are intended to keep code consistent across projects; indentation style cannot be configured. After formatting, Black checks whether the abstract syntax tree remains effectively equivalent and raises an error if the check fails. Install it with pip; it requires Python 3.10 or newer. The documentation lists editor integrations including Emacs, PyCharm, IntelliJ IDEA, Vim, Neovim, Visual Studio Code and Sublime Text, as well as GitHub Actions and doctest workflows. Notebook formatting is available with the jupyter extra, though Black skips cells containing certain magics or invalid syntax. It also includes blackd, an HTTP server that binds to localhost by default. Black is primarily a command-line tool and does not provide a Python interface. Stable releases preserve formatting within the same calendar year when the options match.

Spec sheet

What it does
Black is an opinionated code formatter that formats Python code with consistent style.Read 29 Sep 2026 · black.readthedocs.io
Purpose
Black is an opinionated formatter for Python code that follows PEP 8.Read 28 Sep 2026 · black.readthedocs.io
Integrations
The documentation lists editor and IDE, GitHub Actions, source version control, and doctest formatting integrations.Read 29 Sep 2026 · black.readthedocs.io
License
Black is licensed under the MIT license.Read 29 Sep 2026 · black.readthedocs.io
API limit
Black is fundamentally a command-line tool and does not currently provide a Python interface.Read 28 Sep 2026 · black.readthedocs.io
CI integration
Black provides a GitHub Actions integration that supports GitHub-hosted runner operating systems.Read 28 Sep 2026 · black.readthedocs.io
Code review
Black says it can make code review faster by producing the smallest diffs possible.Read 29 Sep 2026 · black.readthedocs.io
Command line tool
Black is fundamentally a command line tool and the documentation says it does not yet provide a Python interface.Read 29 Sep 2026 · black.readthedocs.io
Configuration limit
Black provides no option to configure indentation style and says requests for that option will not be considered.Read 29 Sep 2026 · black.readthedocs.io
Consistent style
Black limits style options and aims to make code look consistent across projects.Read 28 Sep 2026 · black.readthedocs.io
Docker
Official Black Docker images are available, with tags for releases and prereleases.Read 28 Sep 2026 · black.readthedocs.io
Editor integrations
The documentation describes integrations for editors including PyCharm, Vim, Neovim, Visual Studio Code, and Sublime Text.Read 28 Sep 2026 · black.readthedocs.io
Editor support
Documented editor integrations include Emacs, PyCharm and IntelliJ IDEA, Vim, Neovim, Visual Studio Code, SublimeText, and others.Read 29 Sep 2026 · black.readthedocs.io
Formatting
Black reformats whole files in place and uses a default line length of 88 characters.Read 28 Sep 2026 · black.readthedocs.io
Installation
Black installs with pip or pipx and requires Python 3.10 or later to run.Read 29 Sep 2026 · black.readthedocs.io
Local server
Black includes blackd, an HTTP server that binds to localhost by default.Read 28 Sep 2026 · black.readthedocs.io
Notebook limits
Black skips notebook cells containing automagics, non-Python or multiline magics, transformed magic code, or invalid syntax.Read 29 Sep 2026 · black.readthedocs.io
Notebook support
Jupyter Notebook formatting is available with the black[jupyter] installation extra.Read 29 Sep 2026 · black.readthedocs.io
Python compatibility
Black promises support for Python versions that have not reached end of life, for both running Black and formatting code.Read 29 Sep 2026 · black.readthedocs.io
Safety check
Black checks that reformatted code has a valid AST effectively equivalent to the original and raises an error without changing the file if issues are found.Read 29 Sep 2026 · black.readthedocs.io
Style stability
For stable releases, code formatted with a release remains unchanged under other releases in the same calendar year when using the same options.Read 28 Sep 2026 · black.readthedocs.io

Plans and prices

Black Free MIT-licensed Python code formatter Read 29 Sep 2026 · black.readthedocs.io

Every Black plan and price →

Strong points and limits

Strong points

  • Formats Python files with a consistent PEP 8 style.
  • Checks abstract syntax tree equivalence after formatting.
  • Integrates with editors and GitHub Actions.
  • Notebook formatting is available with the jupyter extra.
  • MIT-licensed and free.

Limits

  • Requires Python 3.10 or newer.
  • Indentation style cannot be configured.
  • Does not provide a Python interface.
  • Some notebook cells are skipped.

Who it suits

Black suits Python developers who want a consistent, opinionated formatter in command-line, editor or CI workflows. It is less suited to users who need configurable indentation or a Python library interface.

Black in depth

Read the full write-up

Overview

Black is a free, MIT-licensed formatter for Python code, aimed at developers and teams that want one shared style without maintaining a long list of formatting preferences. Its strongest case is consistency backed by a syntax-equivalence check; its command-line orientation and fixed style make it a less suitable fit for custom house rules or software that needs a Python library interface.

Key features

Black reformats complete files in place, using an 88-character default line length. That whole-file approach gives projects a uniform result, but it is not a tool for formatting only changed lines. Black says its small diffs can help speed code review, and it checks that a rewrite leaves an effectively equivalent abstract syntax tree, raising an error if that check fails.

The tradeoff is deliberate rigidity. Black does not let users configure indentation style, so teams that need to preserve another convention should choose a formatter with more control. For stable releases, formatting remains unchanged between releases in the same calendar year when options are held constant, reducing the risk of style churn during upgrades.

Jupyter Notebook formatting is available by installing the jupyter extra, though Black skips cells with automagics, non-Python or multiline magics, transformed magic code, or invalid syntax. It also provides blackd, an HTTP server that binds to localhost by default, official Docker images tagged for releases and prereleases, and a GitHub Actions integration for GitHub-hosted runner operating systems.

Pricing

Black costs nothing and is distributed under the MIT License. The free plan is the formatter itself; there is no free trial or paid plan to weigh against it. That makes it a straightforward choice for teams seeking an open-source Python formatter rather than a commercial support arrangement.

Platforms

Black runs on Linux, macOS, and Windows, and can be self-hosted. It installs with pip and requires Python 3.10 or newer to run; Black promises support for Python versions that have not reached end of life, both for running the formatter and formatting code. Its documented integrations cover editors and IDEs including Emacs, PyCharm, IntelliJ IDEA, Vim, Neovim, Visual Studio Code, and Sublime Text, as well as source version control and doctest formatting. The local HTTP server and Docker images give teams additional deployment options, but Black remains fundamentally a command-line tool and has no Python interface.

Who it's for

Black suits Python developers who value uniform output across a project more than individual formatting preferences, and teams that want formatting available through common editors or CI. It is less compelling for users who require an embeddable Python API, configurable indentation, or uninterrupted formatting of notebook cells containing unsupported magic syntax.

Pros and cons

Pros: A single style and 88-character default line length reduce formatting debates across projects.

Pros: The abstract syntax tree check catches cases where a formatting pass fails its equivalence test.

Pros: Free, MIT-licensed use is paired with documented editor, IDE, CI, Docker, and notebook support.

Cons: No indentation-style setting means teams cannot adapt Black to a different indentation convention.

Cons: Whole-file rewriting and the lack of a Python interface limit its fit for changed-lines workflows or library integrations.

Cons: Notebook cells with certain magic commands or invalid syntax are skipped.

Alternatives

For other languages or project types, Code Formatting Tools is the broader category to explore. Choose Prettier when you want an open-source formatter with API, extension, web, and desktop platform support; it also offers enterprise support and maintenance through Tidelift Subscription. rustfmt is the free option to consider for Rust, while Biome is aimed at web projects.

Choose gofmt if you want a free command-line formatter included with a Go installation. Scalafmt is the free alternative for Scala, and Taplo is another free formatter with API and extension platforms. Dart pub and Accessibility Test Framework for Android are listed as alternatives.

Verdict

Choose Black if your Python project needs a free, consistent formatter with a safety check and broad documented editor integration. Its fixed style is the main reason to look elsewhere: teams that need configurable indentation or a Python library API should pick a more adaptable tool.

Verdict

Black offers a consistent formatting approach with safety checks and broad documented editor integration. Its fixed style and command-line focus are key constraints to weigh before adopting it.

Where Specifiction places it

Alternatives to BlackAll alternatives →