# sindresorhus/pretty-bytes

Convert bytes to a human readable string: 1337 → 1.34 kB

Repository: https://github.com/sindresorhus/pretty-bytes
Canonical: https://ross.abutalabs.com/products/pretty-bytes
Language: JavaScript
License: MIT
License Family: permissive
Last push: 2026-07-15T16:58:15+00:00

## Health v2 (maintenance only)
Score: 86/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 92, release rhythm 69, longevity 100
- inputs: {"age_days": 4588, "days_push": 49, "days_rel": 49, "gap_med": 104, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1305, forks 92 (observed 2026-08-28T04:04:18.754913+00:00)

## What it is
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
- artifact type: library
- maturity: stable
- function: serialization, internationalization
- domain: developer-tools, web-development, files
- platform: browser
- tags: file-size, human-readable, bytes, formatting, npm-package, utility, nodejs, javascript

## Member repositories
- sindresorhus/pretty-bytes (main) score 86

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:18.754913+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:51:04.881822+00:00, confidence not recorded.
  - readme: https://github.com/sindresorhus/pretty-bytes (fetched 2026-08-28T04:04:18.754913+00:00, sha b14afda52b7c)
  - registry_npm: https://registry.npmjs.org/pretty-bytes (fetched 2026-08-29T12:09:16.759642+00:00, sha 7ad2b5a1891e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
