Number Base Converter — Binary, Decimal, Hex & Octal
Computers store all data in binary, but humans prefer decimal. Hexadecimal is used for color codes, memory addresses, and encoding. Octal shows up in file permissions and older computing systems. This tool converts any number between all four systems instantly as you type. Just enter a number in any of the four fields below and all the others update automatically. It is useful for programming students, web developers working with colors, and anyone studying how computers represent numbers.
Frequently Asked Questions
What is binary?
Binary is a base-2 number system using only 0 and 1. Computers use binary because circuits have two states: on (1) and off (0). Every number, letter, and file on a computer is ultimately stored as a series of 0s and 1s.
What is hexadecimal used for?
Hexadecimal (base-16) uses digits 0-9 and letters A-F. It is a compact way to represent binary data since one hex digit equals exactly four binary digits. It appears in HTML color codes, memory addresses, and many encoding systems.
What is the difference between binary, octal, and hexadecimal?
Binary is base-2, octal is base-8 (digits 0-7), and hexadecimal is base-16 (digits 0-9 and A-F). All represent the same numbers in different ways. Binary is how computers store data, while octal and hex are more human-readable shorthands for it.
How do I convert decimal to binary?
Divide the number by 2 repeatedly and record the remainders in reverse order. For example, 13 in binary is 1101. This tool does the conversion instantly for any number you enter, so you can verify your manual calculations.
Why do programmers use hexadecimal instead of binary?
Binary is the native language of computers but very verbose — the number 255 requires 8 binary digits (11111111). Hexadecimal (base 16) is a compact shorthand: each hex digit represents exactly 4 binary bits, so 255 is just FF in hex. One byte (8 bits) always maps to exactly two hex digits, making hex ideal for memory addresses, color codes, and binary file inspection.
What is octal and where is it still used?
Octal (base 8) uses digits 0-7. It was important in early computing when 3-bit groups were common. Today its main use is Unix/Linux file permissions — chmod 755 means owner can read/write/execute (7=111 binary), group can read/execute (5=101), others can read/execute (5=101). Each octal digit represents three permission bits: read (4), write (2), execute (1).
How does two's complement represent negative numbers in binary?
Two's complement is the standard way to represent negative integers in binary. To negate a number: flip all bits and add 1. So +5 (0101) becomes -5 (1011) in 4-bit two's complement. The most significant bit acts as the sign bit — 0 is positive, 1 is negative. This system allows the same addition circuitry to handle both positive and negative numbers, which is why all modern processors use it.
How It Works
JavaScript's built-in parseInt(value, base) parses a string in any base into a decimal integer. number.toString(base) converts a decimal integer to a string in the target base. For example, parseInt('FF', 16) returns 255, and (255).toString(2) returns "11111111". All conversions go through the decimal representation as an intermediate step.
Number Base Reference
Decimal (base 10): digits 0-9, everyday counting. Binary (base 2): digits 0-1, native computer language. Octal (base 8): digits 0-7, used for Unix file permissions. Hexadecimal (base 16): digits 0-9 plus A-F, used for memory addresses, colors, and byte representations. Each hex digit maps to exactly 4 binary bits.
Why Computers Use Binary
Electronic circuits naturally have two states: on (1) and off (0). Representing numbers in binary maps directly to these states. A byte is 8 binary digits, which can represent 256 values (0-255). All computation — arithmetic, logic, memory — reduces to combinations of binary on/off states processed by transistors switching billions of times per second.
When to Use This
Use to decode a hex memory address from a crash dump or debugger, to convert a decimal value to binary for a bitwise operation or bit-flag check, to understand Unix file permission octal values, to convert between color formats (decimal RGB to hex), or to verify the output of a manual number base conversion calculation.
More Free Tools
HTML Entity Encoder & Decoder
Encode special characters into safe HTML entities, or decode them back.
Campaign Name Generator
Build UTM-safe marketing campaign names with validation, UTM parameter strings, and a full URL builder.
Lua Code Generator
Generate Lua boilerplate instantly: OOP classes, modules, coroutines, event emitters, state machines, and more.
100 Emoji Generator
Generate a long string of any emoji with separators, prefix text, and a live UTF-8 byte count.