Skip to content
SPECIFICTION
Get listed

Black vs clang-format

Black

black.readthedocs.io

clang-format

clang.llvm.org

Side by side

FigureBlackclang-format
Price fromFree—
Free planYes—
Free trial——
Open source——
WindowsYesYes
macOSYesYes
LinuxYesYes
Self-hostedYes—
Plans published10
Spec score · Code Formatting Tools8.7 (#1)7.6 (#20)
Spec score · Code formatters8.7 (#1)7.7 (#8)
Editor integrationsThe documentation describes integrations for editors including PyCharm, Vim, Neovim, Visual Studio Code, and Sublime Text.The documentation describes integrations for Vim, Emacs, BBEdit, CLion, Visual Studio, and Visual Studio Code.
LicenseBlack is licensed under the MIT license.LLVM releases are distributed under the Apache-2.0 license with LLVM exceptions, which the download page describes as OSI-approved.
PurposeBlack is an opinionated formatter for Python code that follows PEP 8.ClangFormat is a set of tools built on LibFormat for formatting source code, available as a standalone tool and through editor integrations.

Plans

Black

  • BlackFree

Black pricing →

clang-format

No plans published.

clang-format pricing →

In their own words

Black

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.

Visit black.readthedocs.io

clang-format

clang-format has no write-up on Specifiction yet; its figures are above.

Visit clang.llvm.org