Number Base Converter

Convert integers between decimal, binary, hexadecimal, and octal instantly as you type.

Number base converter

Converted number

101010

Decimal
42
Binary
101010
Hexadecimal
2A
Octal
52

How it works

A number base is a positional way of writing the same whole number with a different set of digits. Decimal uses ten digits, binary uses two, hexadecimal uses sixteen, and octal uses eight. This converter rewrites the integer you enter from one base into another.

Example
Number:
42
From:
Decimal
To:
Binary
Converted number:
101010

Questions

What is a number base?

A number base is the number of unique digits a system uses to write integers. The same quantity can be written in more than one base; only the digits change.

What are binary, decimal, hexadecimal, and octal?

Decimal is everyday base 10 (0–9). Binary is base 2 (0 and 1). Octal is base 8 (0–7). Hexadecimal is base 16 (0–9 and A–F). All four can represent the same integer.

How do I convert decimal to binary?

Enter the decimal integer, set From base to Decimal and To base to Binary. The converter updates the binary result as you type. The default example is 42, which becomes 101010.

Can I convert binary back to decimal?

Yes. Set From base to Binary and To base to Decimal, or use Swap after a valid conversion. Binary 101010 converts back to decimal 42.

Can I convert hexadecimal and octal?

Yes. Any supported base can be the source or the target, including hexadecimal and octal in either direction.

Can I convert negative numbers?

Yes. A leading minus sign means a negative integer in every base. It is not two’s complement. Decimal −42 is binary −101010, hexadecimal −2A, and octal −52.

Are leading zeros significant?

Leading zeros are accepted on input and do not change the value. Canonical output drops unnecessary zeros, so 00042 becomes 42. Zero itself is written 0.

Why are letters A–F used in hexadecimal?

Hexadecimal needs sixteen digits. After 0–9, A means 10, B 11, C 12, D 13, E 14, and F 15. Lowercase input is accepted; output uses uppercase A–F.

Can this converter handle very large integers?

Yes. Conversion uses exact integers, not ordinary JavaScript numbers, so values larger than 9,007,199,254,740,991 stay precise. Input is limited to 1,024 digits plus an optional minus sign.