pretty-bytes is a JavaScript utility for converting raw byte counts into compact, human-readable size strings. It uses decimal SI units by default, turning values such as 1337 bytes into 1.34 kB. The library can display bits instead of bytes and can switch to binary prefixes such as KiB when appropriate. Signed output is available for showing positive or negative size differences. Formatting can be localized, and developers can control fractional digits, spacing, and non-breaking spaces. Fixed-width output can align values neatly in tables, status displays, and progress interfaces. The function accepts both regular numbers and BigInt values, making it suitable for a wide range of file-size and data-rate displays.

Features

  • Human-readable byte formatting
  • Bit and byte output modes
  • Decimal and binary unit prefixes
  • Localized number formatting
  • Configurable precision and spacing
  • Fixed-width aligned output

Project Samples

Project Activity

See All Activity >

Categories

Calculators

License

MIT License

Follow pretty-bytes

pretty-bytes Web Site

Other Useful Business Software
Custom VMs From 1 to 96 vCPUs With 99.95% Uptime Icon
Custom VMs From 1 to 96 vCPUs With 99.95% Uptime

General-purpose, compute-optimized, or GPU/TPU-accelerated. Built to your exact specs.

Live migration and automatic failover keep workloads online through maintenance. One free e2-micro VM every month.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of pretty-bytes!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Calculators

Registered

19 hours ago