RepoPilot

Is there an option to display in bits instead of bytes?

About sindresorhus/pretty-bytes · 2 messages · last activity 7/27/2026

Question

Is there an option to display in bits instead of bytes?

RepoPilot

Yes, there is. The bits option allows you to format the number as bits instead of bytes [index.d.ts:L21-L31].

When you set bits: true, the output will display in bit units rather than byte units. For example [readme.md:L69-L71]:

prettyBytes(1337, {bits: true});
//=> '1.34 kbit'

This option is useful for referring to bit rates [index.d.ts:L23]. The default value is false [index.d.ts:L28].

FOLLOW_UPS:

  • What other formatting options are available?
  • How does the binary option differ from bits?
  • Can I control decimal precision with options?

Want to ask your own question?

Open chat for sindresorhus/pretty-bytes

Public Q&A. Generated by RepoPilot from the actual source of sindresorhus/pretty-bytes. AI answers can be incomplete or stale — verify before relying on them.