How the Number Base Converter Works
Type a number in any of the four fields — decimal (base 10), binary (base 2), hexadecimal (base 16), or octal (base 8) — and all other fields update instantly. The converter uses JavaScript's built-in parseInt() for parsing and number.toString() for conversion, so results are accurate up to Number.MAX_SAFE_INTEGER (2⁵³ − 1).
If you enter an invalid character for a base (for example, '2' in a binary field), an error message appears explaining what characters are allowed. Hexadecimal output is always shown in uppercase (A–F). Each field has a Copy button for quick clipboard access.
Number Bases Explained
- Decimal (base 10): the everyday number system using digits 0–9. Each position represents a power of ten. The number 255 means 2×100 + 5×10 + 5×1.
- Binary (base 2): uses only 0 and 1. The fundamental language of computers since all data is stored as sequences of bits (binary digits). 255 in binary is 11111111.
- Hexadecimal (base 16): uses digits 0–9 and letters A–F. Widely used in programming, web colors (#FF5733), memory addresses, and debugging. Compact: one hex digit represents exactly 4 binary bits. 255 = FF.
- Octal (base 8): uses digits 0–7. Historically used in computing and Unix file permissions (chmod 755 uses octal). Less common today but still appears in low-level programming. 255 in octal is 377.
Understanding Number Systems
The decimal system (base 10) uses ten distinct digits — 0 through 9. Its dominance almost certainly comes from the fact that humans have ten fingers. Each position represents a power of 10: rightmost is ones (10⁰), then tens (10¹), then hundreds (10²), and so on. When you write 347, you're really expressing 3×100 + 4×10 + 7×1. Compact and consistent — but it's just one of many valid ways to represent numbers.
Binary (base 2) uses only 0 and 1, and it's the fundamental language of all modern computers. Every processor instruction, every file on disk, every pixel on your screen is ultimately a sequence of bits. The reason is physical: electronic circuits are easiest to build with two stable states — on and off, high voltage and low voltage. A single bit stores one of two values. Eight bits form a byte, representing 2⁸ = 256 distinct values. Binary arithmetic follows the same positional rules as decimal — each position is just a power of 2 instead of 10.
Hexadecimal (base 16) uses 0–9 plus A–F. It emerged as a practical shorthand for binary: one hex digit represents exactly four binary bits (2⁴ = 16). So a full byte (8 bits) is always exactly two hex digits — making memory dumps, color codes, and error codes far more readable than long strings of 0s and 1s. Octal (base 8) uses digits 0–7 and was historically important in early computing — especially in Unix systems, where file permissions are still described with three octal digits. Knowing all four bases gives you a complete toolkit for reading technical docs, debugging code, and working with low-level systems.
Where You Encounter Different Bases
- Binary in networking. IP addresses (IPv4) are 32-bit binary numbers divided into four 8-bit octets and displayed in decimal (e.g., 192.168.1.1). Subnet masks like 255.255.255.0 are also binary in disguise — in binary, 255 = 11111111 and 0 = 00000000. Understanding the binary representation explains why subnet masks always consist of consecutive 1s followed by consecutive 0s.
- Hexadecimal in web design. CSS colors use the #RRGGBB format where each pair of hex digits (00–FF) encodes the intensity of red, green, and blue from 0 to 255. The color #FF0000 is pure red (red = 255, green = 0, blue = 0). Shorthand notation #RGB expands each digit to a pair, so #F30 becomes #FF3300. Modern CSS also supports rgba() but hex remains the most compact and widely used format in design tools.
- Octal in Unix and Linux. File permissions in Unix-based systems are stored as a set of nine bits (read, write, execute for owner, group, and others). These nine bits are often expressed as three octal digits: chmod 755 gives the owner full access (7 = 4+2+1 = rwx), while group and others get read and execute only (5 = 4+1 = r-x). The octal representation maps perfectly to the three-bit groups because 2³ = 8.
- Base64 on the web. Base64 encoding (used for data URIs, email attachments, and JWT tokens) shares the same alphabet as positional base 64 but works differently — it groups binary input into 6-bit chunks and maps each to a character. This converter handles positional base 64, not the encoding scheme. Base64 encoding increases data size by about 33% but makes binary data safe for text-based formats.
Six bases, bit-length padding, and an ASCII bridge
The converter now handles six bases instead of four. Base 32 uses Crockford's alphabet (digits 0–9 then a–v, no ambiguous I/O/L characters), which you'll encounter in Ulid identifiers and some URL-shorteners. Base 64 here is positional — digits 0–9, uppercase A–Z, lowercase a–z, plus +/ — not the Base64 encoding used for binary data in emails or JWTs. That distinction matters. A binary bit-length toggle lets you switch between 8, 16, 32, and 64-bit padding, so 7 in binary shows as 00000111 at 8 bits or 0000000000000111 at 16. Useful when you're reading memory dumps or protocol specs that expect fixed-width fields.
For decimals between 32 and 126 — the printable ASCII range — a character label appears next to the decimal field. Type 65 and you see A. Type 32 and you see the space character noted explicitly. Outside that range, the label stays hidden. Per-character keystroke filtering is active on every input: type a character that's invalid for the current base and it's blocked rather than shown as an error after the fact. What isn't here: floating-point conversion and two's-complement signed negatives.
Frequently Asked Questions
Why is hexadecimal used for web colors?
What does chmod 755 mean in octal?
What is the largest number this converter supports?
How do you convert binary to decimal by hand (without a tool)?
Why do computers use binary instead of just using decimal?
You might also need
See all tools →Complementary tools based on what you're doing