codespell
Fix common misspellings in text files
What it is and what it does
Codespell is a command-line tool that scans text files for a curated set of common misspellings and suggests corrections. Unlike full dictionary checkers, it targets known typos (like "adn" for "and") rather than validating every word, which keeps false positives low when working with niche terminology, code identifiers, or domain-specific language. It's designed primarily for source code but works on any text file.
The tool runs as a standalone CLI with no external runtime dependencies, making it easy to integrate into CI/CD pipelines, pre-commit hooks, or local development workflows. It supports dry-run mode (default), interactive correction, batch writing, word allowlists, file exclusion patterns, and configuration via INI or TOML files. You can also embed inline ignore directives directly in source code using comments.
Use it for:
- Catch typos in source code comments and docstrings before committing.
- Run as a pre-commit hook or CI step to enforce spelling standards across a repository.
- Fix bulk misspellings across a large codebase with the `-w` flag and interactive review.
- Maintain a project-specific allowlist of non-standard terms to avoid repeated false positives.
- Check documentation, README files, and changelog entries for common spelling errors.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Codespell finds and fixes common misspellings in text files, particularly source code, using a curated dictionary of frequent errors rather than full dictionary validation.
Yes. Codespell is actively maintained, has zero known vulnerabilities, installs with no dependencies, and requires only Python 3.9+. It solves a real problem—catching typos in code and docs—with low friction and minimal false positives. The GPL-2.0-only license is copyleft; verify compatibility with your project before shipping it as a dependency, but using it locally as a development tool carries no license risk.
Install
codespell on PyPI
pip
pip install codespelluv
uv add codespellpoetry
poetry add codespellInstalling codespell
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance—last commit 2026-08-10, release 30 days ago. Supports Python 3.9 through 3.13.
License in practice
GPL-2.0-only (copyleft): you may use and modify codespell freely, but any derivative work or distribution must also be licensed under GPL-2.0-only. Check your project's license compatibility before integrating.
Quickstart
pip install codespell
codespell
codespell -w # write changes to files
codespell -L word1,word2 # ignore specific words
Requires Python 3.9 or above.
Verify before relying
- Whether the built-in dictionary covers domain-specific terminology relevant to your codebase.
- Performance characteristics on very large codebases or repositories.
Package facts
| License | GPL-2.0-only (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 30 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,346,962/month — #1,924 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: codespell-2.4.3-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
mkdocs-spellcheckA spell checker plugin for MkDocs that…
permissive · top 15,000 on PyPI
typosFinds and corrects spelling mistakes in source…
permissive · top 5,000 on PyPI
pyspellcheckerDetects misspelled words and suggests…
permissive · top 5,000 on PyPI
pyspellingPySpelling wraps Aspell or Hunspell to automate…
permissive · top 15,000 on PyPI
symspellpysymspellpy is a Python port of SymSpell v6.7.2…
permissive · top 15,000 on PyPI
textsearchFind and replace multiple strings in text with…
permissive · top 15,000 on PyPI
better-profanityDetects and censors profanity in text,…
permissive · top 5,000 on PyPI
fuzzyset2Performs fuzzy string matching and approximate…
permissive · top 15,000 on PyPI
language_tool_pythonPython wrapper for LanguageTool that checks…
copyleft · top 15,000 on PyPI
valeVale is a command-line tool for enforcing…
permissive · top 15,000 on PyPI