Toolman

Number Base Converter

Type a number in any row — the others update instantly.

Bit breakdown

Why computers use binary and hex

Digital circuits have two stable states, so all data is ultimately binary. Binary is unreadable at any length, and decimal does not line up with byte boundaries — but hexadecimal does: one hex digit is exactly four bits, and two hex digits are exactly one byte. That is why memory dumps, colour codes, MAC addresses and hashes are all written in hex.

Common bases

BaseDigitsWhere you meet it
2 (binary)0–1Bit flags, permissions masks, low-level protocols
8 (octal)0–7Unix file permissions — chmod 755
10 (decimal)0–9Everything humans count
16 (hexadecimal)0–9, A–FColours, memory addresses, hashes, byte dumps
360–9, A–ZShort IDs and URL slugs — the densest base using only alphanumerics

Converting by hand

To convert decimal to another base, divide repeatedly by the base and read the remainders from last to first. 255 ÷ 16 = 15 remainder 15, and 15 ÷ 16 = 0 remainder 15, so 255 is FF. Going the other way, multiply each digit by the base raised to its position: FF = 15×16 + 15 = 255.

Binary and hex prefixes in code

0b11111111   binary      (JavaScript, Python, Rust, C++14)
0o377        octal       (JavaScript, Python 3)
0377         octal       (C, older JavaScript — a classic bug source)
0xFF         hexadecimal (almost every language)
255          decimal

Two's complement

Signed integers store negative numbers as the two's complement: invert every bit and add one. In 8 bits, 11111111 is 255 unsigned but −1 signed. This is why a byte holds either 0–255 or −128–127 depending on how you interpret it, and why an unsigned subtraction that goes below zero wraps to a very large number.

Frequently asked questions

What is 255 in binary?

11111111 — eight ones, the largest value that fits in a single byte. In hex it is FF.

What is 0xFF in decimal?

255. Each hex digit is worth four bits, so FF is 15×16 + 15.

Why does chmod use octal?

Unix permissions come in groups of three bits — read, write, execute — for owner, group and others. One octal digit encodes exactly three bits, so 755 is 111 101 101.

What is the largest base supported?

Base 36, which uses 0–9 followed by A–Z. Beyond that there is no agreed alphabet, though Base58 and Base62 exist with their own custom character sets.

How large a number can it handle?

Arbitrarily large — conversion uses JavaScript BigInt, so integers well beyond 64 bits convert exactly with no precision loss.

Related tools