Computing & Networks

Binary, Decimal & Hex Converter

Convert integers between binary, decimal, hexadecimal, and octal.

Enter a number

Enter a decimal whole number, such as 255.

Converted values

Binary
Decimal
Hexadecimal
Octal
Bit length
Minimum bytes

This calculator uses arbitrary-size integers, so it can convert values larger than the normal JavaScript number limit.

Convert Binary, Decimal, Hexadecimal, and Octal

Select the number system your value is currently written in, enter the number, and the converter will show the equivalent value in all four common number bases.

Binary uses base 2, decimal uses base 10, hexadecimal uses base 16, and octal uses base 8.

Binary to Decimal

Select Binary as the input format and enter a value containing only zeros and ones. For example, binary 11111111 equals decimal 255.

Decimal to Binary

Select Decimal and enter an ordinary whole number. The calculator will show its binary representation along with hexadecimal and octal values.

Hexadecimal to Decimal

Select Hexadecimal and enter digits 0–9 and letters A–F. Uppercase and lowercase letters are both accepted.

Binary, Decimal, Hexadecimal, and Octal Conversion Guide

This number base converter translates whole numbers between binary, decimal, hexadecimal, and octal. Enter a value in any one of the four number systems and the calculator shows the equivalent value in all of the others.

It can be used for common conversions such as binary to decimal, decimal to binary, hex to decimal, binary to hex, decimal to hexadecimal, and octal conversions.

Binary to Decimal

Binary is a base-2 number system that uses only the digits 0 and 1. Each position represents a power of 2.

For example, binary 11111111 is equal to decimal 255.

Binary: 11111111
Decimal: 255

To convert binary to decimal manually, multiply each binary digit by the power of 2 represented by its position, beginning with 2⁰ on the right, and add the values together.

Decimal to Binary

Decimal is the ordinary base-10 number system. It uses the digits 0 through 9.

To convert a decimal number to binary, the number can be repeatedly divided by 2. The remainders, read from bottom to top, form the binary representation.

Decimal: 255
Binary: 11111111

You can also enter a decimal number directly into the calculator and select Decimal as the input format.

Hexadecimal to Decimal

Hexadecimal is a base-16 number system. It uses the digits 0 through 9 and the letters A through F.

The hexadecimal letters represent the following decimal values:

A10
B11
C12
D13
E14
F15

For example, hexadecimal FF equals decimal 255.

Hexadecimal: FF
Decimal: 255

Decimal to Hexadecimal

Decimal numbers can be converted to hexadecimal by repeatedly dividing by 16 and converting remainders greater than 9 to the letters A through F.

For example, decimal 255 converts to hexadecimal FF.

Binary to Hexadecimal

Binary and hexadecimal are closely related because one hexadecimal digit represents exactly four binary digits, sometimes called a nibble.

Binary values can therefore be converted to hexadecimal by separating the binary number into groups of four bits starting from the right.

Binary: 1111 1111
Hexadecimal: FF

This relationship is one reason hexadecimal is frequently used to display binary data more compactly.

Hexadecimal to Binary

Each hexadecimal digit can also be converted directly into four binary digits.

00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
A1010
B1011
C1100
D1101
E1110
F1111

Binary to Number

A search for a binary number converter or “binary to number” usually refers to converting a binary value into its ordinary decimal representation.

Select Binary as the input format, enter the sequence of zeros and ones, and read the Decimal result.

What Is Octal?

Octal is a base-8 number system using the digits 0 through 7. Although it is less common than binary, decimal, or hexadecimal in modern everyday computing, it still appears in some programming and computing contexts.

For example, decimal 255 equals octal 377.

Decimal: 255
Octal: 377

What Does Base Mean?

The base, or radix, of a number system determines how many digits are available and what each position represents.

BinaryBase 2 — digits 0 and 1
OctalBase 8 — digits 0 through 7
DecimalBase 10 — digits 0 through 9
HexadecimalBase 16 — digits 0–9 and A–F

Common Number Base Example

The same numerical value can be written differently depending on the number system being used.

Binary: 11111111
Octal: 377
Decimal: 255
Hexadecimal: FF

These are four different representations of the same value.

Binary Prefixes and Hex Prefixes

Programming languages and technical documentation often use prefixes to identify the number system.

0bBinary, such as 0b11111111
0oOctal, such as 0o377
0xHexadecimal, such as 0xFF

This calculator accepts those prefixes when the matching input format is selected. For example, you can enter either FF or 0xFF when Hexadecimal is selected.

Spaces and Underscores in Numbers

Long binary values are often grouped to make them easier to read. This calculator ignores spaces and underscores in the entered value.

For example, these binary inputs represent the same number:

11111111
1111 1111
1111_1111

What Is Bit Length?

A bit is a single binary digit. The bit length shown by the calculator is the number of binary digits required to represent the entered non-negative integer without unnecessary leading zeros.

For example, decimal 255 is binary 11111111 and therefore requires 8 bits.

How Many Bytes Does a Number Need?

One byte contains 8 bits. The calculator shows the minimum number of whole bytes needed to contain the binary representation of the number.

A value requiring 1 through 8 bits needs one byte, while a value requiring 9 through 16 bits needs at least two bytes.

Why Are Binary and Hexadecimal Used in Computing?

Digital systems represent information using binary states, making binary fundamental to computing. Long binary values can be difficult for people to read, so hexadecimal provides a compact way to represent the same bit patterns.

Number base conversion is useful when working with programming, networking, memory addresses, machine-level data, bit masks, permissions, debugging, embedded systems, and other computer systems.

Large Integer Conversion

The converter uses arbitrary-size integer arithmetic rather than ordinary floating-point arithmetic. This allows it to convert integers larger than the usual safe integer limit used by standard JavaScript numbers.

Very long values may still become difficult to read, but the conversion itself is not limited to ordinary 32-bit or 64-bit unsigned values.

Current Calculator Limitations

This calculator is intended for non-negative whole numbers. Negative numbers, fractional values, floating-point representations, signed integer interpretations, and two's-complement conversions are not currently included.

Those formats require additional assumptions, such as a specific bit width or floating-point format, and are better handled separately.