ToolBoxOnline
Developer

Binary Hex Decimal Converter — Number Bases Explained for Developers Who Skipped That CS Lecture

You need to convert #FF5733 to RGB, or 10101100 to decimal, or 255 to hex — and you do not want to do it by hand. A base converter does it in one paste.

binary converterhex converterdecimalnumber basesbase converter

You are reading a binary file format specification and it says "bits 4-7 represent the flags." You need to know what binary 1011 is in decimal. You could calculate it: 8+0+2+1=11. Or you could paste it into a converter and get the answer before you finish the mental math. For one conversion, mental math is fine. For the 40th conversion of the day, it is not.

Our free base converter switches between binary, octal, decimal, and hexadecimal instantly. Here is where number base conversions show up in real development work — not in CS exams, but in the code you write every day.

Where you actually encounter different number bases

Hexadecimal (base-16) — colors and memory addresses: every color in CSS is hex. #FF5733 means FF (255) red, 57 (87) green, 33 (51) blue. Every memory address in a stack trace is hex: 0x7fff5fbff8c0. Every SHA hash is hex: e3b0c44298fc1c14.... If you work with colors, debugging, or cryptography, you work with hex daily — whether you think about it or not.

Binary (base-2) — bitmasks, flags, and file formats: permission systems use bitmasks: read=4 (100), write=2 (010), execute=1 (001). Read+write = 6 (110). File format headers use specific bit positions. Network protocols pack multiple values into single bytes. You do not need to be fluent in binary — you need to convert specific bit patterns to decimal when reading specs and debugging.

Octal (base-8) — Unix file permissions: chmod 755 script.sh — that 755 is octal. 7 = rwx (111), 5 = r-x (101), 5 = r-x (101). Octal appears less often than hex or binary, but when it appears (file permissions, some legacy formats), you need to recognize it.

Decimal (base-10) — the default: everything else. When a spec says "the first byte is the version number," they mean the decimal value of that byte. When a binary value is 11001000, you need to know that is 200 in decimal — because that is the number you will compare, store, or display.

Common conversion mistakes that break things

Mistake 1: Forgetting leading zeros. Binary 101 is 5. Binary 0101 is also 5. But in a byte context (8 bits), 00000101 is 5. If you are reading a spec that says "bits 0-2 represent the priority," you need to extract exactly those 3 bits — not the whole byte. Leading zeros matter for bit position; they do not matter for numeric value.

Mistake 2: Hex case sensitivity that does not exist. FF, ff, and 0xFF are all 255. The 0x prefix is notation, not part of the value. A converter should handle all three. If you are writing a parser, decide on a canonical format (uppercase or lowercase) and normalize all input.

Mistake 3: Confusing decimal and hex values that look similar. 10 in hex is 16 in decimal. 99 in hex is 153 in decimal. If a config file says timeout: 30 and you read it as hex (48 decimal), your timeouts are 60% longer than intended. Always check whether a number is decimal or hex before converting.

Mistake 4: Octal confusion with leading zeros. In many programming languages, 077 is octal (63 decimal), not decimal 77. JavaScript's parseInt('077') historically treated leading zeros as octal. Modern JavaScript requires parseInt('077', 10) for decimal. This has caused real security bugs in older code.

For generating hash values that are always displayed in hex, our hash generator produces SHA-256 and MD5 checksums. For encoding URLs where hex values appear as %XX, see our URL encoder. And for a guide to hash functions in practice, read our hash generator real-world guide.

Tools mentioned in this article

Compartir esta herramienta