Technology

Number Base Converter

One integer, four representations. Convert binary, octal, decimal, and hexadecimal exactly.

Convert an integer

Digits 0–9; no separators or exponent notation. A leading + or − is allowed. Up to 256 digits; use a keyboard minus (-).

Exact conversions

Enter an integer, then select Convert.

Your inputs are processed in your browser and are not sent to a server.

Place values and worked examples

Binary to decimal

Read 101010 in base 2

32 + 8 + 2 = 42

From right to left, the place values are 1, 2, 4, 8, 16, and 32. Add the places with a 1: 101010₂ = 42₁₀.

Hexadecimal to decimal

Read FF in base 16

15 × 16 + 15 = 255

F means 15. FF₁₆ = 255₁₀ = 377₈ = 11111111₂. One hexadecimal digit corresponds to four binary digits when leading zeros are included.

Decimal to binary

Convert 13 by division

13₁₀ = 1101₂

Divide by 2 repeatedly: 13 ÷ 2 = 6 remainder 1; 6 ÷ 2 = 3 remainder 0; 3 ÷ 2 = 1 remainder 1; 1 ÷ 2 = 0 remainder 1. Read the remainders from last to first.

Input rules and exactness

The converter accepts up to 256 input digits, excluding a leading sign and a matching optional prefix. Use 0b for binary, 0o for octal, or 0x for hexadecimal, with the corresponding input base selected. Put the sign first, as in -0xFF. Prefixes and hexadecimal digits are case-insensitive.

Only the selected base's prefix is recognized. In hexadecimal mode, 0B is the valid hexadecimal integer eleven and 1E3 is 483; E is a digit, not an exponent marker. In decimal mode, scientific notation is not accepted. Decimal points, grouping separators, underscores, expressions, and spaces between digits are not accepted in any mode.

Values are read and converted using exact integer arithmetic. Even 9007199254740993, which cannot be represented exactly as a JavaScript Number, stays unchanged as a decimal integer here. A 256-digit hexadecimal input can produce up to 1,024 binary digits. Long results wrap or scroll inside their field and are never truncated.

Negative results keep a leading minus sign: −10 in decimal becomes −1010 in binary. This is a mathematical signed integer, not a fixed-width two's complement bit pattern. No sign extension, storage width, or padding is applied. Zero, including an input such as -000, is displayed as 0.

Implementation reference: MDN — BigInt radix conversion and negative numbers. See our calculation policy for recent-history behavior.

Common questions

Why does the same input give different answers in different bases?

A digit's position has a different value in each base. For example, 100 in binary is 4 in decimal, while 100 in hexadecimal is 256 in decimal. The source selector tells the converter which meaning to use.

Can I convert decimal fractions or floating-point bit patterns?

This converter handles whole integers only. Values such as 10.5, IEEE 754 encodings, and fixed-width signed representations need different rules and are not supported here.

Does hexadecimal FF mean −1?

Here FF means the positive integer 255. In an 8-bit two's complement interpretation, the same bit pattern can represent −1, but that requires a specified width and signed representation. Enter −1 here to convert the mathematical value negative one.

Why did my leading zeros disappear?

Leading zeros do not change an integer's value. The converter displays the shortest digit sequence for each base. If a protocol or file format requires a particular width, apply its padding rules separately.