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
Build Agents and Models on One Platform Icon
Build Agents and Models on One Platform

Everything you need to build production-ready agents and models. Access 200+ Google and third-party AI models and tools.

Gemini Enterprise Agent Platform is Google Cloud's comprehensive platform for developers to build, scale, govern, and optimize agents and models. Choose from Google's most advanced models and third-party models like Anthropic's Claude Model Family.
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