sindresorhus/pretty-bytes
Convert bytes to a human readable string: 1337 → 1.34 kB observed · 2026-08-28
Health v2 · maintenance only
86/100
- Activity 92
- Release rhythm 69
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: 104
- age_days: 4588
- days_rel: 49
- days_push: 49
- n_releases_24m: 4
Adoption not part of the score
1305 stars · 92 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A tiny JavaScript library that converts byte counts into human-readable strings like '1.34 kB'. It supports bits, binary prefixes, signed output, locale-aware formatting, and fixed-width alignment.
Use cases
- format file sizes for display in a UI
- convert bytes to human readable string in JavaScript
- show download progress sizes in a progress bar
- display localized file sizes
- format bit rates for network speeds
- display memory sizes with KiB/MiB binary units
When to choose
- you need a small, dependency-free utility for formatting byte sizes
- you want locale-aware or fixed-width number formatting
- you need both SI (kB) and binary (KiB) prefix support
When to avoid
- you need base-2 formatting by default rather than base-10
- you need to parse human-readable sizes back into bytes
- you're not working in a JavaScript/Node.js environment
Facets
library · maturity stable
serialization internationalization developer-tools web-development files browser file-size human-readable bytes formatting npm-package utility nodejs javascript
2 sources
- readme: https://github.com/sindresorhus/pretty-bytes · fetched 2026-08-28 · b14afda52b7c
- registry_npm: https://registry.npmjs.org/pretty-bytes · fetched 2026-08-29 · 7ad2b5a1891e
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| sindresorhus/pretty-bytes | main | 86 |
For agents
markdown · JSON · MCP: product_card(name="sindresorhus/pretty-bytes")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem