Number Base Converter - Binary, Octal, Decimal, Hex

How to Use the Number Base Converter

Enter a number in any field (binary, octal, decimal, or hexadecimal) and all other bases update instantly. The tool validates your input to ensure you are using valid digits for the selected base. Conversion is bidirectional and works with both small values and large numbers.

Understanding Number Bases

A number base (or radix) determines how many unique digits are available for representing numbers. Decimal uses 10 digits (0-9), binary uses 2 (0-1), octal uses 8 (0-7), and hexadecimal uses 16 (0-9 plus A-F). The same value looks different in each base but represents the same quantity.

Why Multiple Number Bases Exist

Computers operate in binary because transistors have two states: on and off. However, binary is impractical for humans to read because even small numbers become long strings of ones and zeros. Hexadecimal and octal provide shorthand notations that map cleanly to binary but are compact enough for human use.

DecimalBinaryOctalHexadecimal
0000000
10101012A
42101010522A
25511111111377FF
1024100000000002000400

Practical Uses in Software Development

Hexadecimal in Web Development

Web colors use hexadecimal notation. The color #FF5733 represents red=255, green=87, blue=51 in decimal. Each pair of hex digits maps to one byte (0-255) for each color channel. Understanding this mapping helps you mentally adjust colors without a picker. For full color format conversion including HSL, use the Color Converter.

Binary for Bit Flags and Permissions

Binary is essential when working with bit flags, bitmasks, and Unix file permissions. The permission 755 in octal is 111 101 101 in binary, meaning owner has read+write+execute, while group and others have read+execute. Understanding binary helps you read and set permission values correctly.

Hexadecimal in Debugging

Memory addresses, byte values in network packets, and hash digests are all displayed in hexadecimal. When debugging at the byte level, you need to convert between hex and binary frequently. A hex dump of a file shows each byte as a two-character hex value, which is far more readable than the equivalent eight-character binary representation.

Number Base Prefixes in Code

Programming languages use prefixes to distinguish number bases in source code:

LanguageBinaryOctalHexadecimal
JavaScript0b10100o120xA
Python0b10100o120xA
C/C++0b10100120xA
Java0b10100120xA

Note that C-style octal (leading zero without ‘o’) is a common source of bugs. The literal 010 equals 8, not 10, which surprises developers unfamiliar with the convention.

Converting Large Numbers

This tool handles arbitrarily large numbers, not just values that fit in standard integer types. This is useful for working with cryptographic values, large hash outputs, and 64-bit identifiers that exceed the range of 32-bit integers. For working with timestamps that use large integer values, see the Unix Timestamp Converter.

Frequently Asked Questions

How do I convert decimal to binary?

Divide the decimal number by 2 repeatedly, recording each remainder. Read the remainders from bottom to top to get the binary representation. For example, 13 in decimal is 1101 in binary. This tool does the conversion instantly for any number.

Why do programmers use hexadecimal?

Hexadecimal is a compact way to represent binary data. Each hex digit maps to exactly 4 binary digits (bits), so a byte (8 bits) is always 2 hex digits. This makes hex ideal for memory addresses, color values, and byte-level data inspection.

What is the difference between binary, octal, and hexadecimal?

Binary (base 2) uses digits 0-1 and is what computers use internally. Octal (base 8) uses digits 0-7 and is used for Unix file permissions. Hexadecimal (base 16) uses digits 0-9 and A-F and is used for colors, memory addresses, and byte values.