Command-line tool
black
brew/black
Checked 25 Oct 2026, 21:09 UTC · Listing refreshed from Homebrew, winget, npm, Scoop and cargo; npm packages checked against OSV.dev
Python code formatter python hacktoberfest code formatter codeformatter pre-commit-hook autopep8 gofmt yapf
At a glance
- Type
- Command-line tool
- Install on
- Windows, macOS, Linux
- Last checked
- 25 Oct 2026, 21:09 UTC
Install it
Windows
pipx install black winget install --id psf.black -e
macOS
brew install black pipx install black
Linux
brew install black pipx install black
Auto-format a file or entire directory
black path/to/file_or_directory
Format the code passed in as a string
black -c "code"
Show whether a file or a directory would have changes made to them if they were to be formatted
black --check path/to/file_or_directory
Related command-line tools
- gersemi
Formatter to make your CMake code the real treasure formatter cmake cmake-format cmake-language cmakelists… - ruff
Extremely fast Python linter, written in Rust rust python python3 static-analysis linter static-code-analysis ruff… - stylua
Opinionated Lua code formatter hacktoberfest printer formatter lua luau luaformatter pretty-printer stylua - pyrefly
Fast type checker and IDE for Python rust python hacktoberfest ide language-server lsp code-quality typing typechecker… - yapf
Formatter for python code - pre-commit
Framework for managing multi-language pre-commit hooks - lefthook
Fast and powerful Git hooks manager for any type of projects go hacktoberfest git golang manager hooks lefthook - darker
Apply Black formatting only in regions changed since last commit
Listing text is written by the maker; AptLynx lists tools and does not vouch for them. Find another tool · Browse by topic · For agents