Number Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal.
Number systems in computing
Computers store and process everything as binary (base 2). But reading long strings of 1s and 0s is error-prone for humans, so we use more compact representations: octal (base 8) and hexadecimal (base 16). Each hex digit maps to exactly 4 binary bits, making the conversion lossless and mental.
Common uses by base
- Binary — CPU instruction sets, bitmasking, flags, network subnet masks
- Octal — Unix file permissions (chmod), some legacy protocols
- Decimal — Human-readable numbers, port numbers, IP addresses
- Hexadecimal — Memory addresses, color codes, SHA hashes, byte sequences, UUID values
Quick conversion reference
Memorizing a few hex-to-binary pairs makes manual conversion much faster: 0=0000, 1=0001, 4=0100, 8=1000, A=1010, F=1111. Any hex value can be converted to binary by simply substituting each hex digit with its 4-bit binary equivalent.
Common use cases for base conversion
Computer science students use base conversion exercises to understand digital logic and low-level programming. Embedded systems engineers convert between hex and binary when reading datasheet register maps — microcontroller registers are described in hex addresses but manipulated with bitwise operations on binary values. Network engineers convert IP addresses between decimal and binary to understand subnetting and CIDR notation. Security professionals decode hex-encoded payloads and shellcode during malware analysis.
Powers of 2 — the key to base conversions
All base conversions to and from binary hinge on powers of 2. Memorising the first 16 powers is invaluable: 2^0=1, 2^1=2, 2^2=4, 2^3=8, 2^4=16, 2^5=32, 2^6=64, 2^7=128, 2^8=256, 2^9=512, 2^10=1024, 2^16=65536, 2^32=4,294,967,296. These numbers appear constantly in computing — memory sizes (256 MB, 1 KB = 1024 bytes), port numbers, colour channel values (0–255), and binary flags.
How to convert manually — step by step
To convert decimal to binary: repeatedly divide by 2 and record the remainders from bottom to top. For example, 42 ÷ 2 = 21 R0, 21 ÷ 2 = 10 R1, 10 ÷ 2 = 5 R0, 5 ÷ 2 = 2 R1, 2 ÷ 2 = 1 R0, 1 ÷ 2 = 0 R1 → reading remainders bottom-up: 101010. To convert binary to decimal: multiply each bit by its positional power of 2 and sum. For any other base pair, convert to decimal first, then to the target base.
Frequently asked questions
- What is a number base?
- A number base (or radix) defines how many digits a numeral system uses. Decimal (base 10) uses 0–9. Binary (base 2) uses 0 and 1. Octal (base 8) uses 0–7. Hexadecimal (base 16) uses 0–9 and A–F.
- Why do programmers use hexadecimal?
- Hex is compact and maps neatly to binary: each hex digit represents exactly 4 binary bits (a nibble). This makes it easy to read memory addresses, color codes (#FF5733), file signatures, and bytecode without long binary strings.
- How do I convert binary to decimal?
- Multiply each bit by its positional value (powers of 2 from right to left) and sum the results. For example, 1010 in binary = 1×8 + 0×4 + 1×2 + 0×1 = 10 in decimal. This converter does it instantly for any base.
- What is octal used for?
- Octal w in early computing and is still used in Unix/Linux file permission notation (e.g., chmod 755). Each octal digit represents exactly 3 bits, making it a compact alternative to binary.
- What is the nibble grouping in binary?
- Nibble grouping splits binary output into groups of 4 bits (e.g., 1010 1101 instead of 10101101). This matches hex digit boundaries, making it easier to convert mentally between binary and hexadecimal.
Related tools
- JSON Formatter, Validator & Repair Tool
Format, minify, validate, and repair JSON instantly in your browser. Sort keys alphabetically, auto-format on paste, download as file, escape/unescape strings — free, no sign-up, 100% client-side.
- QR Code Generator
Generate QR codes for URLs, text, Wi-Fi, and more. Download as PNG.
- Password Generator
Generate strong, random passwords with custom length and character sets.
- Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to plain text.
- URL Encoder / Decoder
Encode or decode URLs and query strings with percent-encoding.