Binary, Decimal, Hex Converter
Convert numbers between binary (base 2), decimal (base 10), hexadecimal (base 16), and octal (base 8).
Or use the standard form below
What is a binary, decimal, hex converter?
The binary/hex converter handles the number-base conversions used in programming, networking, and digital logic.
How it works
Each base uses its set of digits: binary 0–1, octal 0–7, decimal 0–9, hex 0–9 + A–F. Converting any number works by repeated division.
Worked example
Decimal 255 = 11111111 binary = 377 octal = FF hex. Common because it's the maximum byte value (2⁸ − 1).
How to use this calculator
- Type the number.
- Pick the base of your input.
- All three other bases appear.
Frequently asked questions
Why is hex used in programming?
Hex is base 16 = 2⁴, so each hex digit represents exactly 4 bits. A byte (8 bits) is two hex digits. This makes hex the most compact human-readable format for binary data.
What's the 0x prefix?
Conventional prefixes: 0x for hex (0xFF = 255), 0b for binary, 0o for octal, no prefix for decimal. C, Python, JavaScript all use these.
Why use binary?
Computers store everything as binary (electronic on/off states). Programmers see binary when working with bit flags, low-level networking, encryption, and embedded systems.
What about negative numbers?
This calculator handles unsigned (positive) integers. Negative integers in binary use "two's complement" — a different representation. Most programming contexts use unsigned for converters.