Math

Number Base Converter: Binary, Octal, Decimal, and Hex

By David Brown · June 2026 · 3 min read

Most people count in base 10 without thinking about it. Computers count in base 2. Programmers think in base 16. Linux file permissions live in base 8. The converter above handles all four — type in any field and the others update instantly.

The Four Bases at a Glance

BaseNameDigits usedCommon use
2Binary0, 1Computer hardware, logic gates
8Octal0–7Unix/Linux file permissions
10Decimal0–9Everyday counting
16Hexadecimal0–9, A–FMemory addresses, color codes, debugging

Why Hex Is a Programmer's Best Friend

Binary is exact but verbose. The decimal number 4,294,967,295 (the maximum value of a 32-bit unsigned integer) in binary is 32 ones in a row. In hex it's FFFFFFFF — 8 characters. Each hex digit represents exactly 4 bits, so conversion between binary and hex is mechanical: split the binary into groups of 4 from the right and convert each group.

DecimalBinaryOctalHex
0000
10101012A
15111117F
16100002010
25511111111377FF
1024100000000002000400

Where You'll Actually See These

Hex color codes — #FF6B00 is three hex pairs: FF (255 red), 6B (107 green), 00 (0 blue). Every web color is six hex digits.

IP addresses in disguise — Some systems display IP addresses as a single hex number. 0xC0A80101 = 192.168.1.1 in decimal.

chmod permissionschmod 755 uses octal. 7 = rwx, 5 = r-x, so 755 means owner can do everything, group and others can read and execute.

Debugging memory — Debuggers, hex editors, and assembly listings all show addresses and values in hex because it maps cleanly to the underlying byte boundaries.

Convert between bases →

Frequently Asked Questions

Why do computers use binary?

Computers are built from transistors that have two states: on or off. Binary maps perfectly to this — 1 is on, 0 is off. Every number, character, image, and instruction stored in a computer is ultimately a sequence of 1s and 0s. Decimal would require 10 voltage levels per digit, which is much harder to build reliably in hardware.

Why do programmers use hexadecimal instead of binary?

Binary gets long fast — the decimal number 255 is 11111111 in binary (8 digits). Hex is a shorthand: each hex digit represents exactly 4 binary digits (bits), so 255 = FF in hex (just 2 digits). Programmers use hex for memory addresses, color codes (#FF6B00), file headers, and anywhere they need a compact human-readable view of raw binary data.

What is octal used for?

Octal (base 8) is mostly a legacy format still used in Unix/Linux file permissions. When you run 'chmod 755' on a file, 755 is octal: 7 = 111 (read+write+execute for owner), 5 = 101 (read+execute for group), 5 = 101 (read+execute for others). Each octal digit maps to exactly 3 binary digits, making it a compact way to represent permission bit patterns.

How do I convert between bases by hand?

To convert decimal to another base: repeatedly divide by the target base and collect the remainders from bottom to top. For 255 to binary: 255÷2=127 R1, 127÷2=63 R1 … read remainders upward: 11111111. To go from binary to decimal: multiply each digit by 2 raised to its position (rightmost is position 0) and sum them all.

This article is for informational purposes only. See our disclaimer.