Play n Tools

Free tools & games for everyone

Free · No sign-up · No accounts

Binary & number base converter

Convert between binary, octal, decimal, hex and any base to 36, exactly and at any size, plus two's complement, UTF-8 bytes and bit operations.

How to use

  1. Convert: type a number and say which base it is written in. Binary, octal, decimal, hex and one more base of your choice appear at once. Prefixes such as 0x, 0b and 0o work too, and spaces or underscores are ignored.
  2. Two's complement: see how a negative number is stored in 8, 16, 32 or 64 bits, or read a bit pattern back as a signed number.
  3. Text & bytes: turn text into its UTF-8 bytes, or bytes back into text.
  4. Bit operations: AND, OR, XOR, NOT and shifts on a fixed number of bits, with the answer in every form.

Click any result box to select it, then copy.

Keyboard and touch

Tab / Shift+TabMove between boxes; a result box selects itself
Ctrl+C (Cmd+C on Mac)Copy the selected result
Arrow keys in a listChange base, width or operation

Tips

  • Each hex digit is exactly four binary digits, so binary is shown in groups of four: 1111 0000 = F0.
  • In two's complement, flipping every bit and adding 1 gives the negative: 42 is 0010 1010 and −42 is 1101 0110.
  • Many decimal fractions never end in binary: 0.1 is 0.000110011… forever. That is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.
  • English letters take one byte in UTF-8; accented letters take two; most symbols and emoji take three or four.

About this tool

Whole numbers of any size are converted exactly, digit by digit, so even 100-digit numbers come out right (most calculators round after about 16 digits). Fractions are exact when they end in the target base; otherwise 40 places are shown. During development, 2,000 random numbers of up to 60 digits were checked in every base pair against an independent implementation.

Text is encoded as UTF-8, the encoding used by almost every web page. Broken byte sequences are reported, not guessed. Nothing you type leaves your device.

See you tomorrow!

A fresh daily puzzle every morning, and new tools added every month.

Browse every product