DIGITAL · TOOL

Bits ⇄ Range

How large can n bits represent — unsigned/signed range and total count.

Basic No backend · 100% client-side

What it does: Computes the representable range from a bit width, or reverse-looks up the bit width needed.

When to use it: Choosing a variable type, fixing a field width, or guarding against overflow.

→ 0–255 / −128–127
Next

You might also need

How to

How to use the bits-to-range calculator

Just enter the bit width.

  1. 01

    Enter the bit width

    1–64 bits, for example 8, 16, 32.

  2. 02

    Click Calculate

    Get the representable unsigned and signed (two's complement) ranges and the total count.

  3. 03

    Use it in reverse

    You can also enter a value below to find "the minimum number of bits needed to hold it".

Reference

Common bit-width ranges

Unsigned 0…2ⁿ−1; signed −2ⁿ⁻¹…2ⁿ⁻¹−1.

Bit widthUnsigned maxSigned range
8255−128 … 127
1665,535−32,768 … 32,767
324,294,967,295−2.1e9 … 2.1e9
641.8e19−9.2e18 … 9.2e18

Powers of 2, exact with BigInt.

FAQ

Common questions, answered in 3 minutes

Why is the signed maximum about half the unsigned maximum?

A signed value uses the top bit as a sign bit, leaving one fewer value bit, so the positive maximum is about half that of unsigned.

How many numbers can 8 bits represent?

2⁸ = 256: unsigned 0–255, or signed −128–127.

Why does signed have one extra negative number?

In two's complement, 0 takes only one encoding, and the spare one goes to −2ⁿ⁻¹, so there is one more negative number than positive.

Data Provenance

Standards and sources referenced by this tool

Item Value / Formula Source
Range Unsigned 2ⁿ−1 / signed ±2ⁿ⁻¹ Binary representation

Exact with BigInt, no external API.

⚡ Powered by Circflow