Computers · digital

Bit Calculator

Binary, hex, octal and decimal — plus the two conversions that actually catch people out: 1000 versus 1024, and bits versus bytes.
two's complement · BigInt
0xB4 · 8-bit

Value

8-bit
DEC
HEX
OCT
BIN

Bit grid

click any bit to flip it0xB4
bit = 1 bit = 0
At a glance
Sizes

Why a 1 TB drive shows up as 931 GB

the same bytes, counted two different ways
shortfall against the binary unit

Neither number is wrong. The drive really does hold a million million bytes; Windows really is dividing by 1024 three times and calling the answer GB. The two families were reconciled in 1998 — IEC 80000-13 gave the binary ones their own names (kibi, mebi, gibi) — and almost nobody adopted them, so the same three letters still mean two things about 7% apart at terabyte scale. macOS and Linux report decimal GB; Windows reports binary and labels it GB.

Rates

Your 100 Mbps line does not move 100 MB a second

the factor of eight, and what is left after overhead
if you read Mbps as MB/s ÷8, the arithmetic answer after overhead
Bitwise lab

Combine two values, bit by bit

columns line up so you can see each result bit form
0x
0x
Field notes

The ideas behind the bits

How it works

One number, four ways to write it

A whole number is just a number — binary, hex, octal and decimal are only different notations for the same value. Computers store it as bits, group those bits into bytes, and cap the whole thing at a fixed word size (8, 16, 32 or 64 bits). This tool shows all four notations at once, lets you flip individual bits, and applies the same masking and two's-complement wrap-around that real hardware uses.

Worked example

The byte 0xB4 is 180 unsigned, or −76 signed (its top bit is set). In binary it's 1011 0100 — four bits set. Flip the top bit and the unsigned value drops by 128; NOT it and you get 0x4B (75), because every bit inverts.

In the lab, 0xF0 AND 0x3C keeps only the bits set in both0x30. Line the three rows up and each result bit is just its column's AND.

Why does the value wrap when I overflow?

A word size is a fixed number of bits. Anything past the top bit has nowhere to go, so it's dropped — the value "wraps" modulo 2ⁿ. That's exactly what a CPU register does, and it's why 255 + 1 = 0 in a byte.

What's two's complement?

The standard way to store negative integers: the top bit carries a negative weight. In a byte, values 0–127 are themselves; 128–255 represent −128 to −1. Switch to signed to see it — the bits don't change, only how the decimal is read.

Hex vs octal — why hex won?

One hex digit maps to exactly four bits (a nibble), so a byte is two clean hex digits. Octal packs three bits per digit, which doesn't line up with 8-bit bytes — handy for old systems and Unix permissions, but hex fits modern hardware better.

How is 64-bit handled correctly?

JavaScript's normal bitwise operators only work on 32 bits. This tool uses BigInt for everything, so 64-bit shifts, rotates and masks are exact — no silent truncation.

What this page assumes

The bit grid and bitwise lab take whole numbers only — no fractions and no floating point, which has an entirely different bit layout. The size and rate sections further down are ordinary decimal arithmetic and do accept fractions. Signed values use two’s complement, and the selected word size wraps around rather than reporting an error, exactly as hardware does. Byte order (endianness) does not appear here at all: it affects how a value is laid out in memory or sent over a wire, not what the value is.

Exact, arbitrary-width integer math. Values are masked to the selected word size using two's-complement rules — the same wrap-around real hardware does.
Version history · site-wide passes only

This page has changed in 50 archived releases, but each of those was a site-wide pass, so none is attributable to this tool on its own and none is listed here. That is not a claim that the tool never changed — a release that reworked many pages at once may well have altered this one too. The changelog has them.