LinthelmIntroductions to linters, static analysis and code-quality tools

Formatters

What is Black? An introduction to Python Software Foundation's Python code formatter

By the Linthelm editorial team · Published · Updated

Black is an uncompromising Python code formatter. It takes over the formatting of your code so that you no longer decide it by hand, and in return you get speed, determinism and smaller diffs. Its documentation describes it as "the uncompromising code formatter".

Tool
Black
Made by
Python Software Foundation
Official site
black.readthedocs.io
Category
Formatters

Who makes Black

Black is published under the Python Software Foundation as its vendor. The project's documentation is hosted at black.readthedocs.io.

The official website is linked below. It is the place to find the documentation on usage, integrations and introducing Black to a project.

Official website: black.readthedocs.io

What Black is for

Black exists to format Python source code automatically. Instead of debating line breaks, spacing and layout, you hand those decisions to the tool and accept its output. The project's own framing is a trade: you cede control over hand-formatting in exchange for speed, determinism and freedom from pycodestyle formatting nagging.

The practical payoff shows up in review. Black produces the smallest diffs possible, which makes code review faster because reviewers see real changes instead of stylistic noise. Formatted code also looks the same across projects, so moving between codebases that use Black involves less visual adjustment.

Who Black is for

The vendor states two audiences: Python developers, and project teams adopting a shared code style. An individual developer can use it to stop thinking about formatting. A team can use it to settle style questions once, by making the formatter the single source of truth.

Because the documentation includes guidance on introducing Black to a project, it also addresses teams that already have an existing codebase and want to adopt it.

Notable capabilities

Black is deliberately narrow in scope, and its capabilities mostly concern how safely and conveniently it can be run in different workflows.

  • Equivalence checking: Black checks that reformatted code still produces an equivalent AST, so formatting does not silently change what the program does. The --fast option skips this safety check.
  • Server mode: Black can run as a server via blackd, which suits setups that want a long-running formatting service.
  • GitHub Actions integration: it offers a GitHub Actions integration for running it in automated workflows.
  • Version control integration: it also integrates with version control, so formatting can be part of the commit workflow.
  • Jupyter Notebooks: it can be used with Jupyter Notebooks, extending formatting beyond plain Python files.
  • README badge: projects can display a 'Code style: black' badge in their README to signal the style they follow.
  • Use with other tools: the documentation covers using Black alongside other tools.
  • MIT license: Black is licensed under the MIT license.

How Black fits formatters

Within the formatters category, Black is a tool that rewrites code rather than reporting on it. Its focus is layout and style, and it makes those choices for you instead of exposing a large set of options. It is considered stable and has a comprehensive test suite, and future stylistic changes will mostly respond to bug reports and new Python syntax.

In Linthelm's wider niche of linters, static analysis and code quality, a formatter handles one specific concern: consistent appearance. Linters and static analyzers look for suspect patterns, rule violations or potential defects, while a formatter removes formatting as a topic of discussion. Black's documentation addresses using it with other tools, which reflects how formatters are commonly paired with checkers in a code quality setup.

Frequently asked questions

What is Black used for?

Black is used to automatically format Python code. It trades control over formatting details for speed, determinism and smaller diffs, which makes code review faster.

Who develops Black?

The vendor is the Python Software Foundation. The official website is black.readthedocs.io.

Does Black change what my code does?

Black checks that reformatted code still produces an equivalent AST. The --fast option skips this safety check.

Can Black be used with Jupyter Notebooks?

Yes. Black can be used with Jupyter Notebooks.

How is Black licensed?

Black is licensed under the MIT license.

Sources. This introduction is based on the vendor's official pages, checked on 21 November 2026 (Asia/Dhaka):

Linthelm is independent and is not affiliated with Python Software Foundation. Product names belong to their owners. Features change; confirm details on the official website.