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
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
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

2026-09-09