Skip to main content

Base Converter

Convert whole numbers between decimal, hex, binary and octal up to 64 bits, flip bits by hand and try AND, OR, XOR, NOT and shifts.

Number

Base
A 0x, 0b or 0o prefix picks its own base. Spaces, _ and ' between digits are ignored.
Word

Bits

Values

Type a number to see it in every base.

  • Decimal—
  • Hexadecimal—
  • Binary—
  • Octal—
Bitwise

Runs in your browser; nothing you enter leaves this page.

How it works

Reading what you type

The number is read in the base you pick, unless it starts with a prefix: 0x for hexadecimal, 0b for binary, 0o for octal. In hexadecimal, 0b is read as the digits B, so 0b12 means 0xB12. Spaces, underscores and apostrophes between digits are ignored, so 1_000_000 and 1'000'000 both work.

Values are held as exact big integers, from 0 up to 18,446,744,073,709,551,615 (the largest unsigned 64-bit number), so nothing is rounded the way a calculator rounds past 2^53.

value = Σ digitᵢ × baseⁱ

Words and bits

The register draws the number as a word of 8, 16, 32 or 64 bits, one byte per block with its two hex digits above and its bit numbers below. Click any bit to flip it; the number updates in every base. Word sizes too small for the value are switched off.

When the top bit of the word is set, the value is also shown as a signed number in two’s complement, the way a signed integer of that width would read it.

signed = value − 2ʷ when bit w−1 is 1

Bitwise operations

Turn on Bitwise to combine A with B using AND, OR or XOR, invert A with NOT, or shift it left or right. Results are cut to the word size, so NOT 0 in an 8-bit word is 255 and shifting 0x80 left by one in 8 bits gives 0.

More tools

All 238 tools