Number Base

Convert a number between decimal, binary, octal, and hexadecimal representations.

Monitor this automatically

NetTests can run this check on a schedule, preserve historical results, compare changes over time, and alert you the moment something breaks.

Start monitoring free → See all monitoring products

Frequently Asked Questions

What are the different number bases?

Decimal (base 10) — everyday numbers using digits 0–9. Binary (base 2) — computers store all data as 0s and 1s. Octal (base 8) — digits 0–7; historically used for Unix file permissions (chmod 755). Hexadecimal (base 16) — digits 0–9 and A–F; compact representation of binary data, used in colors, memory addresses, and hashes.

Why do programmers use hexadecimal so often?

Each hex digit represents exactly 4 bits, so a byte (8 bits) is always exactly two hex digits. This makes it easy to inspect raw binary data — a Secure Hash Algorithm 256 (SHA-256) hash is 64 hex characters instead of 256 ones and zeros. Internet Protocol version 6 (IPv6) addresses, Media Access Control (MAC) addresses, and color codes are all written in hex for the same compactness reason.

How do I convert in code?

In Python: bin(42)'0b101010', hex(255)'0xff', oct(8)'0o10'. To convert back: int('ff', 16) → 255, int('1010', 2) → 10. In JavaScript: (255).toString(16)'ff', parseInt('ff', 16) → 255.