Number Base Converter

Convert a decimal number into binary, octal and hexadecimal, the number systems computers and programmers use.

How Binary Works: Each binary digit (bit) is worth double the one to its right: 1, 2, 4, 8, 16, 32, 64, 128... A number is the sum of the positions holding a 1.

Example:

Decimal 255

255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, so every one of the 8 bits is 1.

Binary = 1111 1111

Octal = 377

Hexadecimal = FF (each hex digit groups 4 bits; F stands for 15)

Octal groups bits in threes and hexadecimal in fours, which is why programmers use them as shorthand for long binary strings.

Frequently Asked Questions

Why do computers use binary at all?

Computer circuits are built from switches that are either on or off, two states that map perfectly onto 1 and 0. Everything a computer handles (numbers, text, images, sound) is encoded as patterns of these bits.

Why is hexadecimal so common in programming?

One hex digit is exactly 4 bits, so two hex digits describe one byte precisely. Colours like #FF5733, memory addresses and error codes are all hex shorthand for binary values that would be far longer written out.