Byte Size Calculator
Pick a data type, enter how many values you store and the largest number you expect. The calculator gives the total size in bytes, KB and MB, the bits per value and the smallest integer type that still holds your largest number.
- Bytes per type
- Memory for many values
- Smallest integer type
These are raw sizes, as in a binary file, database column or packed array.
Every value takes a fixed number of bytes. A 32-bit integer takes 4 bytes and a 64-bit one takes 8. Ten million 32-bit numbers use 40 MB. If your largest number is under 65,536, a 16-bit type holds it and halves the memory.
Data type sizes
Common types. Search for a type.
| Type | Bytes | Bits | Range or use |
|---|---|---|---|
| Boolean | 1 | 8 | True or false |
| 8-bit integer | 1 | 8 | 0 to 255 |
| 16-bit integer | 2 | 16 | 0 to 65,535 |
| 32-bit integer | 4 | 32 | 0 to about 4.3 billion |
| 64-bit integer | 8 | 64 | 0 to about 1.8 × 10¹⁹ |
| Float | 4 | 32 | About 7 digits |
| Double | 8 | 64 | About 15 digits |
| UUID | 16 | 128 | Unique id |
Unsigned ranges shown for integers.
Bits and bytes
One value. Slide the bits you need.
Each square is a byte of eight bits. Filled bits are in use.
How to work out bytes
Type to memory. Step through it.
Pick the type
Integer, float, id.
Signed integers give up one bit for the sign, so their largest value is half as big.
16-bit, 32-bit or 64-bit integers
Integer widths. Compare them.
Small numbers.
Everyday.
Huge numbers.
Choosing a type too small causes overflow. Leave room for growth.
Before you choose
Type checks. Tick each item.
Tick each item as you go.
Strings and objects have overhead in memory, so measure them separately.
What you get
Data sizing. Each tile explains one result.
Bytes.
KiB, MiB.
Bytes.
Needed.
Smallest fit.
One byte is eight bits. A kilobyte is 1,000 bytes, and a kibibyte is 1,024.
Frequently Asked Questions
No question matches that search.
How many bytes is an integer?
Usually four bytes for a thirty-two bit integer and eight for a sixty-four bit one.
How many bits are in a byte?
Eight.
How many bytes is a double?
Eight bytes.
How do I find the bits needed for a number?
Take the base two logarithm of the number plus one and round up.
What is the difference between KB and KiB?
A KB is one thousand bytes and a KiB is one thousand and twenty-four bytes.
How big is a UUID?
Sixteen bytes stored as binary, or thirty-six characters as text.
Does a boolean really use a whole byte?
Usually yes, though packed bit arrays can store eight in one byte.
Store it lean
Pick the smallest type that safely holds your numbers, and large datasets shrink with no loss.
More size calculators
Each one has its own calculator, worked examples and answers to common questions.