Binary Number System & Converter
Base 2Work comfortably with the binary number system. Convert between binary, decimal, hexadecimal, octal and text (ASCII/UTF-8), see bits grouped for readability, and review core formulas so you can reason about binary at a professional level.
Suitable for CS students, developers, embedded engineers and anyone debugging low-level data, protocols or memory layouts.
Interactive binary toolbox
Choose how the value you type is currently written.
You can optionally prefix with 0b, 0x or 0o; the base selector still controls validation.
Binary as a positional system (base 2)
Like decimal, the binary system is positional: each digit (bit) has a weight that depends on its position. In base 10 the weights are powers of 10 (1, 10, 100, …); in base 2 they are powers of 2:
For a binary number \(b_{n-1} \dots b_2 b_1 b_0\) with bits \(b_i \in \{0,1\}\):
\[ (b_{n-1} \dots b_1 b_0)_2 = \sum_{i=0}^{n-1} b_i 2^i. \]Example: the binary number \(101101_2\) equals
Hexadecimal and octal as compact binary
Binary is natural for machines but verbose for humans. Two derived bases are used as compact notations:
- Hexadecimal (base 16) uses digits 0–9 and letters A–F for values 10–15. One hex digit corresponds to 4 bits.
- Octal (base 8) uses digits 0–7. One octal digit corresponds to 3 bits.
Grouping binary digits (bits) into 4-bit nibbles or 8-bit bytes builds the mental bridge between binary and hex used in debuggers and low-level tooling.
Binary arithmetic in a nutshell
Binary arithmetic obeys the same rules as decimal, but carries occur at powers of 2:
Addition table:
- \(0 + 0 = 0\)
- \(0 + 1 = 1\)
- \(1 + 0 = 1\)
- \(1 + 1 = 10_2\) (write 0 and carry 1)
Higher-level operations (subtraction, multiplication, division) reduce to the same algorithms you know from decimal, but carried out bit by bit. In practice, programmers often rely on built-in integer types and bitwise operators, while using tools like this calculator to inspect and reason about binary representations.
Text and binary: bytes, codes and encodings
Computers do not “store letters”, they store bytes. A byte is typically 8 bits, which can represent integers from 0 to 255. Text encodings (ASCII, UTF-8 and others) map these integers to characters.
For example, in ASCII/UTF-8:
- 'A' → 65 → \(01000001_2\)
- 'a' → 97 → \(01100001_2\)
- '0' → 48 → \(00110000_2\)
The Text ⇄ Binary tab shows the 8-bit code for each character, which is extremely helpful when you are debugging encoding problems, serial protocols or binary file formats.