Convert any number between decimal, hexadecimal, binary, and octal. Shows ASCII character value, Unicode codepoint, and bit/byte analysis.
enter a number to convert
Input value
Input base
Quick values
All bases (click to copy)
How to Use the Hex/Binary Converter
Enter your value — type a number in decimal (base 10), hexadecimal (base 16), binary (base 2), or octal (base 8).
Select input base — choose which number system your input is in.
Read all conversions — the tool instantly shows the same value in all four number systems simultaneously.
Convert colours — enter a hex colour code (#FF5733) to see RGB values, or enter RGB to get hex.
Bit manipulation — see the binary representation to understand bit patterns for low-level programming and networking.
💡 Quick recognition: Decimal: digits 0-9 only. Hexadecimal: digits 0-9 and letters A-F (often prefixed with 0x: 0xFF). Binary: only 0s and 1s (often prefixed with 0b: 0b11001100). Octal: digits 0-7 (often prefixed with 0: 0777). Recognising the prefix tells you the number system immediately.
Understanding Number Systems
🔢 Decimal (Base 10)
The familiar number system using digits 0–9. Each position represents a power of 10: hundreds, tens, ones. 234 = 2×100 + 3×10 + 4×1. Used for all everyday counting and arithmetic. Computers do not natively use decimal — it is converted to binary for processing.
⚡ Binary (Base 2)
Uses only 0 and 1. Each digit is a 'bit.' Each position is a power of 2. 1010 in binary = 1×8 + 0×4 + 1×2 + 0×1 = 10 in decimal. Fundamental to computing — transistors have two states (on/off) making binary the natural language of hardware.
🔵 Hexadecimal (Base 16)
Uses digits 0-9 and letters A-F (A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit represents exactly 4 binary bits. This makes hex a compact binary representation: FF in hex = 11111111 in binary = 255 in decimal. Used extensively in programming for colour codes, memory addresses, hash values, and MAC addresses.
🔴 Octal (Base 8)
Uses digits 0–7. Each octal digit represents 3 binary bits. Less common in modern programming but important for Unix file permissions: chmod 755 = rwxr-xr-x = 111 101 101 in binary. Understanding octal is essential for Unix/Linux system administration.
🎨 Hex Colours
CSS colours use hex: #RRGGBB. Each pair of hex digits (00-FF) represents one colour channel (0-255). #FF0000 = red (255,0,0). #00FF00 = green (0,255,0). #0000FF = blue (0,0,255). #FFFFFF = white (255,255,255). #000000 = black (0,0,0). Three-digit shorthand #RGB = #RRGGBB when both digits match: #F05 = #FF0055.
📡 Networking
IPv4 addresses shown in decimal (192.168.1.1) are actually 32 binary bits. IPv6 uses hex (2001:0db8:85a3:0000:0000:8a2e:0370:7334). MAC addresses are 48 bits shown as 6 hex pairs (00:1A:2B:3C:4D:5E). Subnet masks (255.255.255.0 = /24 = 11111111.11111111.11111111.00000000) are understood through binary representation.
Number Systems in Development
Bit manipulation
Low-level programming often uses bitwise operations on binary representations. AND (&): masks bits. OR (|): sets bits. XOR (^): toggles bits. NOT (~): flips all bits. Left shift (<<): multiply by 2. Right shift (>>): divide by 2. Example: checking if a number is even — (n & 1) === 0 checks the last bit (0 = even, 1 = odd). Bit manipulation is faster than arithmetic for these operations and appears frequently in embedded systems, graphics programming, and performance-critical code.
Memory addresses and debugging
Debuggers show memory addresses in hex: 0x7fff5fbff8b0. Hex is compact (one digit per 4 bits) making large addresses readable: 0x1A3F (4 hex digits) vs 6719 (decimal) vs 1101000111111 (13 binary digits). When debugging memory issues, crashes, or reading stack traces, hex addresses are the universal format. Understanding hex-to-binary conversion helps interpret bit patterns in memory dumps and understand alignment requirements.
Unix file permissions
Unix permissions use octal: 755 = rwxr-xr-x. Breaking down: 7 = 111 = rwx (owner: read, write, execute). 5 = 101 = r-x (group: read, execute). 5 = 101 = r-x (others: read, execute). Common permissions: 644 (rw-r--r--) for files, 755 (rwxr-xr-x) for directories and executables, 600 (rw-------) for private files. Understanding the binary representation of these octal values makes permission logic intuitive.
🔢 Conversion quick reference: Decimal→Hex: divide by 16 repeatedly, remainders in reverse. Hex→Binary: each hex digit = 4 binary bits (F=1111, A=1010, 0=0000). Binary→Decimal: sum powers of 2 for each '1' bit. Hex→Decimal: multiply each digit by its power of 16. In practice, this tool eliminates the need for manual conversion — use it and focus on understanding the number systems conceptually.
Frequently Asked Questions
Why do programmers use hexadecimal?
Hex is compact — one hex digit represents exactly 4 binary bits, so 2 hex digits represent one byte (8 bits). Memory addresses, color codes (#FF5733), and byte values are all naturally expressed in hex. It bridges the gap between binary (machine-level) and decimal (human-readable).
What is binary and why does it matter?
Binary (base 2) is the language of computers — every bit is either 0 or 1, representing off or on states in transistors. Understanding binary helps with bitwise operations, network subnetting, file permissions (chmod 755 = 111 101 101 in binary), and low-level programming.
How do I convert hex to decimal in my head?
Multiply each digit by its positional power of 16. Example: 0xFF = (15×16) + 15 = 240 + 15 = 255. Or: the last digit is its value, each position left multiplies by 16. Common values to memorise: 0x0A=10, 0x10=16, 0x64=100, 0xFF=255.
What is octal (base 8)?
Octal uses digits 0–7. Each octal digit represents 3 binary bits. Octal is used in Unix/Linux file permissions — chmod 755 means owner:rwx (7=111), group:r-x (5=101), others:r-x (5=101). Less common than hex but still encountered in embedded systems.