Number Base Converter Guide: Binary, Hex, Octal & Decimal Explained
What Are Number Bases?
A number base — also called a radix — defines how many unique digits a positional numeral system uses. The base determines the value each digit position represents as a power of that base. Humans default to base 10 (decimal) because we have ten fingers. Computers default to base 2 (binary) because transistors have two stable states: on and off.
Understanding number bases is not academic trivia. Every time you write a hex color code like #FF5733, configure a subnet mask, examine a memory address in a debugger, or read a file permission like chmod 755, you're working with non-decimal number systems. The Number Base Converter at SnapUtils converts between all four common bases simultaneously, so you never have to do the math by hand.
The Four Common Bases in Computing
| Base | Name | Digits Used | Common Prefix | Primary Use |
|---|---|---|---|---|
| 2 | Binary | 0, 1 | 0b | CPU logic, networking, bit flags |
| 8 | Octal | 0–7 | 0o or 0 | Unix file permissions, legacy systems |
| 10 | Decimal | 0–9 | (none) | Human-readable numbers, general math |
| 16 | Hexadecimal | 0–9, A–F | 0x | Memory addresses, color codes, encoding |
Binary (Base 2): The Language of Machines
Binary is the foundation of all digital computing. Every piece of data a computer processes — a pixel on your screen, a character in a text file, an instruction in a program — is ultimately stored and manipulated as a sequence of bits, each either 0 or 1.
In binary, each position represents a power of 2. Reading right to left: 2⁰ = 1, 2¹ = 2, 2² = 4, 2³ = 8, and so on. The binary number 1011 means: (1 × 8) + (0 × 4) + (1 × 2) + (1 × 1) = 8 + 0 + 2 + 1 = 11 in decimal.
Bits are grouped into bytes (8 bits), which gives values from 0 to 255. A byte in binary can represent 00000000 (0) through 11111111 (255). This is why 255.255.255.0 is such a common subnet mask — each octet is exactly one byte, and 11111111 in binary is FF in hex and 255 in decimal.
Hexadecimal (Base 16): The Programmer's Shorthand
Hexadecimal is binary's compact cousin. Because 16 = 2⁴, every hex digit maps directly to exactly 4 binary bits (a nibble). This makes hex an efficient shorthand for binary: a full byte (11110101 in binary) becomes just two hex digits (F5). Reading a memory dump in binary is tedious; the same data in hex is legible.
Hex uses the digits 0–9 and then A–F to represent values 10–15. The hex number 2F means: (2 × 16¹) + (15 × 16⁰) = 32 + 15 = 47 in decimal. You will encounter 0x prefix notation constantly in programming: 0xFF, 0x1A4B, 0xDEADBEEF.
Hex in Everyday Computing
- CSS color codes:
#RRGGBB— each channel is one byte (0–255), expressed as two hex digits.#FF0000is full red (255, 0, 0).#808080is mid-gray (128, 128, 128). - Memory addresses: Debuggers and disassemblers display addresses in hex:
0x00007FFE4A2B1000. The 64-bit address space is 16 hex digits wide. - MAC addresses: Network interface hardware addresses are 6 bytes written as hex pairs:
00:1A:2B:3C:4D:5E. - Cryptographic hashes: SHA-256 outputs 256 bits — displayed as 64 hex characters. Try our Hash Generator to see this in action.
- Unicode code points: Characters are identified by code points in hex: U+0041 is 'A', U+1F600 is 😀.
- File format magic bytes: Files start with a signature — PDF files begin with
25 50 44 46(%PDFin ASCII), PNG files with89 50 4E 47.
Octal (Base 8): Unix Permissions and Legacy Systems
Octal uses digits 0–7. Each octal digit represents exactly 3 binary bits, making octal another compact binary shorthand. On systems where bytes align to 3-bit boundaries rather than 4-bit ones, octal is more natural than hex.
Today, octal's primary home is Unix file permissions. The chmod command uses a 3-digit octal number: 755, 644, 777. Each digit controls permissions for owner, group, and others respectively. The values are: read (4), write (2), execute (1). Add them together: 7 = rwx (4+2+1), 5 = r-x (4+0+1), 4 = r-- (4+0+0). So chmod 755 means the owner can read/write/execute; group and others can only read and execute.
Octal also appears in older programming contexts — C allows octal literals prefixed with 0 (note: not 0o), which is a historical source of bugs when developers add leading zeros to decimal numbers expecting decimal behavior.
How to Convert Between Bases: The Division Method
Converting a decimal number to any other base follows a consistent algorithm: repeatedly divide by the target base and collect the remainders in reverse order.
Decimal to Binary Example: Converting 42
- 42 ÷ 2 = 21, remainder 0
- 21 ÷ 2 = 10, remainder 1
- 10 ÷ 2 = 5, remainder 0
- 5 ÷ 2 = 2, remainder 1
- 2 ÷ 2 = 1, remainder 0
- 1 ÷ 2 = 0, remainder 1
Reading the remainders bottom to top: 101010. Verify: 32 + 0 + 8 + 0 + 2 + 0 = 42. ✓
Decimal to Hex Example: Converting 255
- 255 ÷ 16 = 15, remainder 15 (= F)
- 15 ÷ 16 = 0, remainder 15 (= F)
Reading bottom to top: FF. This is why 255 is always 0xFF in hex — and why full-brightness color channels in CSS are FF.
Converting from Binary to Hex Directly
Group the binary digits into groups of 4 from the right, then convert each group independently. For 10111101: group as 1011 and 1101. 1011 = 11 = B. 1101 = 13 = D. Result: BD.
Skip the Manual Math
Convert between binary, octal, decimal, and hexadecimal instantly. All four fields update simultaneously, BigInt precision for massive numbers, step-by-step conversion shown, batch mode included.
Open Number Base Converter →Real-World Use Cases
Networking: IP Addresses and Subnet Masks
IPv4 addresses are 32-bit numbers written as four decimal octets for human readability. Every networking operation — routing, subnetting, CIDR notation — operates on the binary representation underneath. Understanding that 192.168.1.0/24 means the first 24 bits are the network prefix (binary 11000000.10101000.00000001) and the remaining 8 bits are the host range requires fluency in binary-to-decimal conversion.
Subnet masks like 255.255.255.0 are simply 11111111.11111111.11111111.00000000 in binary — a block of 1s followed by a block of 0s. The /24 CIDR notation counts those leading 1s. This is pure binary math applied to network architecture. The Unix Timestamp Converter and Unit Converter follow the same principle — tools that make number relationships immediately visible reduce errors and save time.
Digital Electronics: Bit Flags and Registers
In embedded systems and low-level programming, individual bits in a byte control hardware features. A GPIO register might use bit 0 for input/output direction, bit 1 for pull-up resistor enable, bit 2 for interrupt enable. Setting and reading these requires bitwise operations on binary values. The hex representation 0x07 (binary 00000111) enables all three features simultaneously. Thinking in hex and binary is mandatory in this domain.
Debugging and Reverse Engineering
When examining a core dump, a network packet capture, or a compiled binary, data appears as raw bytes in hex. Understanding that 4E 45 58 54 spells "NEXT" in ASCII, or that 00 00 00 2A is the 32-bit big-endian integer 42, requires instant hex-to-decimal-to-ASCII mental translation. Developers who work at this level do these conversions constantly.
Color Representation in Web Development
CSS hex colors are three concatenated byte values: #RRGGBB. Shorthand notation #RGB doubles each digit: #F08 expands to #FF0088. When a designer specifies rgba(255, 127, 0, 0.5) and your CSS uses hex colors throughout, converting 127 to 7F (two hex digits) and 0 to 00 is a routine task that a base converter eliminates entirely.
How the SnapUtils Number Base Converter Works
The SnapUtils Number Base Converter goes further than a simple input-output tool. Here's what makes it useful for real development work:
- Four simultaneous fields: Enter any value in binary, octal, decimal, or hex — all four fields update in real time. No need to convert twice when you need multiple target bases.
- BigInt precision: JavaScript's standard
Numbertype loses precision above 2⁵³. The converter uses BigInt arithmetic, so you can accurately convert 64-bit values, large memory addresses, and cryptographic numbers without silent rounding errors. - Auto-detect prefixes: Type
0xFFand it recognizes hex. Type0b1010and it reads binary. Type0o17and it parses octal. No manual base selection required for prefixed inputs. - Step-by-step conversion: The tool can show the division algorithm steps — useful for students learning the math, or developers who need to verify a specific conversion method.
- Batch mode: Paste a list of numbers and convert them all at once. Essential when parsing log files, processing hex dumps, or converting arrays of values.
- Bit grouping: Binary output is grouped in nibbles (4-bit groups) or bytes (8-bit groups) for readability.
10110101becomes1011 0101— much easier to read in a hardware context.
Binary, Octal, Hex Quick Reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 5 | 0101 | 5 | 5 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 0001 0000 | 20 | 10 |
| 42 | 0010 1010 | 52 | 2A |
| 127 | 0111 1111 | 177 | 7F |
| 255 | 1111 1111 | 377 | FF |
Frequently Asked Questions
How do I convert binary to decimal?
Write down each binary digit and multiply it by 2 raised to its position (counting from zero on the right). Sum all the products. For 1101: (1 × 8) + (1 × 4) + (0 × 2) + (1 × 1) = 8 + 4 + 0 + 1 = 13. Alternatively, use the Number Base Converter and type the binary value directly — the decimal result appears instantly.
Why do programmers use hexadecimal instead of binary?
Hex is a compact representation of binary. Since one hex digit equals exactly four binary bits, a full 32-bit value requires 8 hex characters instead of 32 binary digits. 0x4F3A2B1C is far more readable and less error-prone than 01001111001110100010101100011100. Both represent the same value — hex is just human-friendlier. Conversion between the two is mechanical and instant, which is why developers who work with binary data think in hex.
What is the difference between binary and hexadecimal?
Binary (base 2) uses only 0 and 1 — the direct language of digital circuits. Hexadecimal (base 16) uses 0–9 and A–F, providing a compact shorthand for binary. Every hex digit is exactly 4 binary bits: 0 = 0000, F = 1111. They represent the same information in different forms. Computers process binary; developers read hex.
How is octal used in Unix file permissions?
Unix file permissions are 9 bits: read/write/execute for owner, group, and others. These 9 bits are naturally expressed as three 3-bit groups — perfect for octal, where each digit represents 3 bits. The chmod 755 command sets owner to rwx (7 = 4+2+1), group to r-x (5 = 4+0+1), and others to r-x (5). Writing this as chmod 111101101 in binary would work but is unreadable. Octal makes the permission structure immediately clear.
Can the Number Base Converter handle very large numbers?
Yes. The SnapUtils Number Base Converter uses JavaScript BigInt, which supports arbitrary-precision integers. It handles 64-bit integers (common in memory addresses, database IDs, and cryptographic operations), 128-bit UUIDs, and numbers with hundreds of digits. Standard JavaScript Number loses precision above 2⁵³ — the BigInt implementation avoids that entirely.
What does 0xFF mean?
0xFF is a hexadecimal number. The 0x prefix indicates hex notation; FF is two hex digits. F in hex equals 15 in decimal; FF = (15 × 16) + 15 = 255. In binary, FF = 11111111 — all 8 bits set to 1. You encounter 0xFF as the maximum value of an unsigned byte, as a full-brightness CSS color channel, as a bitmask selecting all 8 bits, and in many other contexts.
Convert Numbers Between Any Base
Binary to decimal, hex to decimal, octal to binary — all four bases simultaneously. BigInt precision, auto-prefix detection, step-by-step breakdown, and batch mode. No sign-up required.
Open Number Base Converter →