bitmath
Pythonic module for representing and manipulating file sizes with different prefix notations (file size unit conversion)
Decision gist · record as of 2026-08-14
Yes. bitmath is actively maintained, has no dependencies, installs cleanly, carries permissive MIT licensing, and solves a concrete problem—file size unit conversion and arithmetic—that many tools need. Use it whenever you work with storage sizes and want to avoid manual conversion logic or string parsing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or newer.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained with a recent release 81 days ago and ongoing repository activity.
License · maintenance · safety
permissive license (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal obligations.
last release 2026-05-25 (81 days) · last repo commit 2026-08-14 · 96 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 396,904 downloads/mo, #6,967 on PyPI
Alternatives
Verify before relying
pip install bitmath
import bitmath
log_size = bitmath.kB(137.4)
log_zipped = bitmath.Byte(987)
print(log_size - log_zipped)What it is and what it does
bitmath is a Python library for working with file sizes in different unit systems. It handles conversion between SI units (kB, MB, GB) and NIST binary units (KiB, MiB, GiB, and up to YiB), letting you treat sizes as first-class objects that support arithmetic, comparison, and formatting. The library includes no external dependencies beyond Python's standard library.
You use it when you need to convert between unit systems, perform capacity calculations (like fitting files on a drive), or display file sizes in human-readable form. It supports floor division and modulo for capacity planning (e.g., how many 300 MiB chunks fit in 1 GiB), rich comparisons so 1024 Bytes equals 1 KiB, and integrates with Python's format protocol and argparse for CLI tools.
Use it for
- Convert storage sizes between SI and NIST units for display or calculation in file management tools.
- Calculate how many files or chunks fit on a device using floor division and modulo operations.
- Format file sizes for human-readable output in logs, reports, or interactive shells.
- Perform arithmetic on sizes (subtract, divide, compare) without manual unit conversion.
- Parse and validate file size input from command-line arguments or user configuration.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
bitmath is actively maintained, has no dependencies, installs cleanly, carries permissive MIT licensing, and solves a concrete problem—file size unit conversion and arithmetic—that many tools need. Use it whenever you work with storage sizes and want to avoid manual conversion logic or string parsing.
Install
bitmath on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with a recent release 81 days ago and ongoing repository activity.
Requires Python 3.9 or newer.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal obligations.
Quickstart
pip install bitmath
import bitmath
log_size = bitmath.kB(137.4)
log_zipped = bitmath.Byte(987)
print(log_size - log_zipped)
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 81 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 396,904 / month, #6,967 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsIntended Audience :: Telecommunications IndustryLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Communications :: File SharingTopic :: InternetTopic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Information AnalysisTopic :: Scientific/Engineering :: MathematicsTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: TestingTopic :: Software Development :: Testing :: AcceptanceTopic :: Software Development :: Testing :: UnitTopic :: System :: FilesystemsTopic :: System :: Systems AdministrationTopic :: Text Processing :: FiltersTopic :: Utilities |
Evidence: bitmath-2.1.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “byte size arithmetic”
- bitmathbitmath converts and performs arithmetic on file sizes across SI and…
- hurry.filesizeConverts byte counts into human-readable file size strings using…
- cobsEncodes and decodes data using Consistent Overhead Byte Stuffing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also binary · hurry.filesize · prefixed · django-mathfilters · anycrc · pyroaring · tibs · fxpmath · fixedint