Number Base Converter

Convert numbers between binary, decimal, hexadecimal, and octal instantly with our free online number base converter.

Developer ToolsFreeNo Signup
Number Base Converter
Free Tool

How to use Number Base Converter

**How to Use the Number Base Converter** Converting between number systems is one of the most common tasks in programming and computer science. Whether you need to convert hex to decimal to debug a color code, translate binary to decimal for a CS assignment, or flip between bases while analyzing memory addresses, this free tool handles all of it instantly. **What Are Number Bases?** Every number system uses a base (radix) defining how many unique digits it uses before rolling over. - **Base 2 (Binary):** Digits 0 and 1. Every value inside a computer processor is ultimately binary. Example: decimal 13 in binary is 1101. - **Base 8 (Octal):** Digits 0-7. Used in older Unix systems for file permissions (chmod 755). - **Base 10 (Decimal):** Digits 0-9. The everyday human number system. - **Base 16 (Hexadecimal):** Digits 0-9 plus A-F (A=10 through F=15). Used in HTML color codes (#FF5733), memory addresses, and byte values. **Quick Reference Table** | Decimal | Hex | Binary | |---------|-----|--------| | 0 | 0 | 0000 | | 5 | 5 | 0101 | | 10 | A | 1010 | | 15 | F | 1111 | | 16 | 10 | 0001 0000 | | 255 | FF | 1111 1111 | | 256 | 100 | 0001 0000 0000 | **Step-by-Step: How to Use This Tool** 1. Enter your number in the input field. 2. Select the source base: Binary (2), Octal (8), Decimal (10), or Hexadecimal (16). 3. Select the target base from the To dropdown. 4. Click Convert — or the result updates automatically as you type. 5. Copy the result with one click. **Real-World Developer Examples** **Example 1 — Decoding an HTML Color Code** The CSS color #FF6B00 is an orange. Hex color codes use pairs of hex digits for each channel: FF (red), 6B (green), 00 (blue). - FF hex = 255 decimal = full red saturation - 6B hex = 107 decimal = about 42% green - 00 hex = 0 decimal = no blue Converting hex to decimal for each channel lets you visualize where a color sits in the RGB spectrum. **Example 2 — Reading a Binary IPv4 Address** The address 192.168.1.1 in binary: 192 = 1100 0000, 168 = 1010 1000, 1 = 0000 0001. Subnet masks (/24, /16) only make sense when you see how binary ANDing works on these values — a fundamental concept in CCNA and AWS networking certifications. **Example 3 — Debugging a Memory Address** A debugger like GDB shows memory addresses in hex: 0x1A2B3C. Converting to decimal gives 1,715,004. Hex is preferred for addresses because one hex digit represents exactly 4 bits (a nibble), keeping addresses compact and aligned. **Example 4 — ASCII Character Codes** The letter A has ASCII code 65 in decimal, 41 in hex, and 0100 0001 in binary. When you see \x41 in a Python string or hex dump, you know it is the letter A. Understanding ASCII in hex is essential for reading hex dumps and analyzing network packets. **Manual Conversion Methods** **Binary to Decimal (positional value)** Each binary digit represents a power of 2, starting from the rightmost (2^0 = 1). Example: 1101 in binary = 1x8 + 1x4 + 0x2 + 1x1 = 13. **Decimal to Hex (repeated division)** Divide by 16, track remainders. Example: 255 / 16 = 15 remainder 15 (F). 15 / 16 = 0 remainder 15 (F). Read bottom to top: FF. **Hex to Binary (nibble substitution)** Each hex digit maps directly to 4 binary digits. Example: 3A in hex. 3 = 0011, A = 1010. Result: 0011 1010. **5 Common Mistakes** **Mistake 1: Forgetting the 0x prefix for hex** In C, Java, and JavaScript, hex literals need the 0x prefix: write 0xFF not just FF. Without the prefix, the language reads it as a variable name. **Mistake 2: Confusing octal with decimal** In C-family languages, a number starting with 0 is octal. Writing int perm = 0755 gives decimal 493, not 755. This causes subtle bugs in Unix permission code. **Mistake 3: Signed vs. unsigned binary** In signed binary (two's complement), the leftmost bit is the sign bit. The 8-bit value 1111 1111 is 255 unsigned but -1 signed. **Mistake 4: Dropping leading zeros in binary** Decimal 5 in 8-bit binary is 0000 0101, not just 101. At byte level, dropping leading zeros shifts bit alignment and causes off-by-one errors. **Mistake 5: Hex case mismatches** Hex is case-insensitive (FF = ff), but some tools and security contexts expect a specific case. CSS accepts both #ff5733 and #FF5733. Always match the case expected by the target system. **Pro Tips** Bitwise operations are obvious in binary: AND-ing 1100 with 1010 gives 1000 — only the bit that is 1 in both inputs survives. Visualizing binary makes bitmask operations and permission systems much clearer. Two's complement for negative numbers: invert all bits, then add 1. Decimal -5 in 8-bit: start with 0000 0101, invert to 1111 1010, add 1 = 1111 1011 = 0xFB. Hex is best for byte boundaries: the 32-bit sentinel value 0xDEADBEEF (3,735,928,559 decimal) is instantly recognizable as a 4-byte value used by Microsoft's debugger to mark freed heap memory. **When Each Base Is Used** | Base | Primary Use | |------|-------------| | Binary | CPU instructions, bitwise operations, networking, digital logic | | Octal | Unix file permissions, some legacy embedded systems | | Decimal | Human-facing numbers, math, finance | | Hex | Memory addresses, color codes, byte values, cryptography hashes, UUIDs |

Frequently Asked Questions

How do I convert hex to decimal?

To convert hex to decimal, multiply each digit by its positional power of 16 and sum the results. For 3F: 3x16 + 15x1 = 48 + 15 = 63. Or use this free converter — enter the hex value, select base 16 as source and base 10 as target, and get the result instantly with the full step-by-step calculation shown.

Why do computers use binary instead of decimal?

Computer hardware is built from transistors with two stable states: on (high voltage) and off (low voltage). Binary maps directly to these states — 1 for on, 0 for off. It is far simpler and more reliable to build circuits that distinguish two voltage levels than ten, making binary the natural language of all digital electronics.

What is the difference between decimal and hexadecimal?

Decimal uses ten digits (0-9). Hexadecimal uses sixteen: digits 0-9 plus letters A-F, where A=10 through F=15. Hex is preferred in programming because each hex digit represents exactly four binary bits (a nibble), making byte-level data compact and readable. The decimal number 255 equals hex FF, which equals binary 11111111.

How do I read a hex color code like #FF5733?

Hex color codes are three concatenated hex pairs for red, green, and blue channels. #FF5733 means FF (red) = 255, 57 (green) = 87, 33 (blue) = 51. Each channel ranges from 00 (0) to FF (255). Convert each hex pair to decimal to understand the RGB values and predict how the color will render.

When is octal used in modern programming?

Octal is most common in Unix and Linux file permissions. The chmod command uses octal: chmod 755 sets owner to read/write/execute (7=111 binary) and group/others to read/execute (5=101 binary). Some older assembly languages and embedded systems also use octal, but binary and hex are far more prevalent in modern development.

Recommended

Related Tools