Number Base Converter — Binary, Octal, Decimal & Hex
Convert numbers between binary (2), octal (8), decimal (10), and hexadecimal (16) simultaneously.
| Binary | Enter a value above | |
| Octal | Enter a value above | |
| Decimal | Enter a value above | |
| Hex | Enter a value above |
About Number Base Converter — Binary, Octal, Decimal & Hex
Number Base Converter converts integers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) with a single click. It is an essential tool for computer science students and developers working with bitwise operations, memory addresses, and color codes.
How to Use
- 1Enter your number in the "Number to Convert" field.
- 2Select the input base from the dropdown (Binary, Octal, Decimal, or Hexadecimal).
- 3Click "Convert Base" to see the equivalent values in all four bases.
Features
- Converts between all four common number bases simultaneously
- Supports large integers without loss of precision
- Useful for low-level programming and bitwise operation debugging
- Instant conversion with no page reload
Number Bases in Computing
Computers store everything as binary, but developers routinely work with decimal, hexadecimal, and octal representations. Understanding each base and when to use it is fundamental to low-level programming.
Binary (Base 2) and Its Role in Hardware
Binary is the native language of digital hardware — every transistor in a CPU is either on (1) or off (0). A single binary digit is called a bit. Eight bits form a byte, which can represent 256 unique values (0–255 in decimal). Binary is directly used when working with bitwise operators (AND, OR, XOR, NOT, left shift, right shift) in languages like C, Java, and Python. Bitwise operations are used in permission flags, network masks, compression algorithms, and protocol field parsing. For example, a file permission mask of 0b110100100 directly shows which read, write, and execute bits are set for owner, group, and others. When you see a number like 0b1010 in code, it is a binary literal equal to decimal 10.
Hexadecimal (Base 16): The Programmer's Shorthand
Hexadecimal uses 16 symbols: 0–9 and A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Its key advantage is that each hex digit represents exactly 4 bits, so one byte is always exactly two hex digits. This makes hexadecimal a compact and readable shorthand for binary data. Memory addresses (0x7fff5fbff8b8), color codes (#ff6600), MAC addresses (00:1A:2B:3C:4D:5E), and UUID values are all commonly expressed in hex. In C and many other languages, hex literals are prefixed with 0x. Octal (base 8) uses digits 0–7 and was historically used in Unix file permissions — the familiar chmod 755 command uses octal, where 7=rwx, 5=r-x.
Practical Base Conversion Scenarios
Base conversion is a daily task in systems programming, networking, and embedded development. These patterns illustrate where the skill is most applied.
Bitwise Operations and Flag Masking
When debugging bitwise operations, converting intermediate values between binary and decimal helps verify that the correct bits are set or cleared. For instance, if you apply a bitwise AND mask 0b11110000 to a byte value, converting the result to decimal confirms the expected outcome. Permission systems in operating systems, network protocols, and hardware registers rely heavily on individual bits within a byte or word. Being able to mentally or programmatically convert between binary and hex is essential for reading hardware datasheets, parsing network packets, and implementing cryptographic primitives where individual bit patterns carry meaning.
Color Values and Memory Addresses
Web color codes like #1a73e8 are simply three hexadecimal bytes: 0x1A for red (26 decimal), 0x73 for green (115 decimal), and 0xE8 for blue (232 decimal). Converting these to decimal is useful when feeding colors into APIs that accept decimal RGB values, or when comparing colors mathematically. Memory addresses printed by debuggers (e.g., 0x00007fff5fbff890) are hexadecimal representations of binary memory locations. Understanding that 0xFF = 255, 0x100 = 256, and 0xFFFF = 65535 lets you quickly interpret memory layout, buffer boundaries, and integer overflow conditions at a glance.
FAQ
- Can I convert hexadecimal color codes with this tool?
- Yes. Enter a hex color value (without #) to see its decimal equivalent, though for full color conversion the Color Code Converter is more appropriate.
- Does it support negative numbers?
- The tool converts positive integers. Negative number representations (two's complement) are not currently supported.
- What is the maximum number size?
- The tool uses JavaScript's BigInt where available, supporting very large integers beyond the standard 32-bit limit.
- How do I represent negative numbers in binary?
- Computers use two's complement to represent negative integers in binary. To convert a positive binary number to its negative equivalent: invert all bits (change 0 to 1 and 1 to 0), then add 1. For example, +5 in 8-bit binary is 00000101. Inverting gives 11111010, adding 1 gives 11111011, which represents -5. The most significant bit (leftmost) serves as the sign bit: 0 means positive, 1 means negative.
- What is hexadecimal used for in programming?
- Hexadecimal (base-16) is widely used because it maps cleanly to binary — each hex digit represents exactly 4 binary bits. This makes it compact and readable for representing binary data. Common uses include: memory addresses (0x7fff5fbff8c0), color codes (#FF5733), byte values in network packets, file magic numbers, CPU register values, and Unicode code points (U+1F600). The 0x prefix is the standard notation for hex values in most programming languages.
Found a bug or something not working as expected?
Report a bug →