Number Base Converter
Convert between Binary, Octal, Decimal, and Hexadecimal
Instant conversion between different number systems. Perfect for programmers, students, and anyone working with computer science.
Binary (Base 2)
Uses digits: 0, 1
Octal (Base 8)
Uses digits: 0-7
Decimal (Base 10)
Uses digits: 0-9
Hexadecimal (Base 16)
Uses: 0-9, A-F
Quick Reference Table
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 31 | 11111 | 37 | 1F |
| 32 | 100000 | 40 | 20 |
| 63 | 111111 | 77 | 3F |
| 64 | 1000000 | 100 | 40 |
| 127 | 1111111 | 177 | 7F |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
Number Systems Explained
Binary (Base 2)
Fundamental to all digital electronics. Each digit represents a power of 2. Used in computer memory, processors, and digital logic.
Octal (Base 8)
Historical importance in computing. Each octal digit represents 3 binary digits. Still used in Unix file permissions.
Decimal (Base 10)
The standard number system we use daily. Based on powers of 10. Most intuitive for human understanding.
Hexadecimal (Base 16)
Compact representation of binary. Each hex digit = 4 binary digits. Widely used for colors, memory addresses, and debugging.
Common Use Cases
- ๐ข Programming: Convert between bases for bitwise operations and debugging
- ๐จ Web Design: Convert hex color codes to RGB decimal values
- ๐พ Memory Addresses: Read hexadecimal memory addresses in decimal
- ๐ File Permissions: Understand Unix octal permission values
- ๐ Learning: Computer science education and understanding low-level programming
- โ๏ธ Hardware: Configure embedded systems and microcontrollers
How It Works
The conversion process works in two steps. First, the input number is parsed from its source base into an intermediate representation. Each digit is multiplied by the base raised to the power of its position (counting from right, starting at 0), and the products are summed. For example, binary 1011 becomes: (1ร2ยณ) + (0ร2ยฒ) + (1ร2ยน) + (1ร2โฐ) = 8 + 0 + 2 + 1 = 11 in decimal.
Second, the intermediate value is converted to the target base through repeated division. The number is divided by the target base, and the remainder becomes the rightmost digit. The quotient is divided again, producing the next digit, and this continues until the quotient reaches zero. The remainders, read in reverse order, form the result. For bases above 10, remainders 10-35 are represented by letters A-Z.
The tool handles these conversions using JavaScript's built-in parseInt() for parsing and toString() for output, with validation to ensure digits are valid for the specified base.
Use Cases
Developers constantly convert between binary, hex, and decimal when working with bitwise operations, memory addresses, color codes, file headers, and low-level system programming. Understanding the relationship between 0xFF, 255, and 11111111 is essential for debugging and writing correct bit manipulation code.
2. Digital Electronics & Hardware Design
Electrical engineers designing digital circuits, FPGA configurations, and microcontroller firmware work primarily in binary and hexadecimal. Converting between bases helps translate between schematic-level binary signals and human-readable hex notation used in datasheets and documentation.
3. Networking & IP Addressing
Network engineers convert between binary and decimal to calculate subnet masks, IP ranges, and CIDR notation. Understanding that a /24 subnet mask is 11111111.11111111.11111111.00000000 in binary and 255.255.255.0 in decimal is fundamental to network configuration and troubleshooting.
4. Computer Science Education
Students learning number systems, data representation, and computer architecture use base converters to check their manual conversion work and build intuition about how computers store and process numbers. Seeing the same value in multiple bases simultaneously reinforces understanding.
5. Cryptography & Security
Cryptographic work frequently involves hex-encoded values โ hash digests, encryption keys, and initialization vectors are typically displayed in hexadecimal. Converting between hex and binary helps analysts understand the actual bit patterns underlying cryptographic operations and verify implementations.
Tips & Best Practices
โข Use octal for Unix file permissions: Unix permissions (read=4, write=2, execute=1) are naturally represented in octal. 755 means rwxr-xr-x: owner gets 7 (4+2+1), group and others get 5 (4+0+1).
โข Remember powers of 2: Memorizing powers of 2 up to 2ยนโฐ (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024) makes mental binary-to-decimal conversion much faster and helps you quickly estimate binary number sizes.
โข Group binary digits for readability: When writing long binary numbers, group digits in sets of 4 (nibbles) or 8 (bytes) for readability: 1101 0011 1010 0001 is much easier to read than 1101001110100001.
โข Verify your conversions bidirectionally: After converting a number, convert the result back to the original base to verify correctness. This catches transcription errors and builds confidence in your results.
โข Use hex for color codes in web development: CSS colors like #FF5733 are hexadecimal: FF=255 red, 57=87 green, 33=51 blue. Understanding this mapping helps you tweak colors by adjusting hex values directly without a color picker.
Frequently Asked Questions
Related Tools
Explore more tools that might help you