Number Base Converter
Convert numbers between decimal, binary, octal, and hexadecimal. Instant conversion with copy buttons.
Common Values
DecBinOctHex
Decimal (Base 10)
42
Binary (Base 2)
0b101010
Octal (Base 8)
0o52
Hexadecimal (Base 16)
0x2A
Frequently Asked Questions
How do number bases work?+
Decimal (base 10) uses digits 0-9. Binary (base 2) uses 0-1. Octal (base 8) uses 0-7. Hexadecimal (base 16) uses 0-9 and A-F. Each position represents a power of the base.
How to convert decimal to binary?+
Divide by 2 repeatedly, tracking remainders. 42 → 42/2=21r0, 21/2=10r1, 10/2=5r0, 5/2=2r1, 2/2=1r0, 1/2=0r1. Read remainders bottom to top: 101010.
Why is hexadecimal used in programming?+
Hex is compact — each hex digit maps to exactly 4 binary bits. So a byte (8 bits) is always 2 hex digits. Color codes like #FF0000 are hex: FF=255 red, 00=0 green, 00=0 blue.