Number base converter: binary, octal, decimal and hexadecimal

Convert integers among four common positional systems: binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). The calculation uses JavaScript BigInt so large accepted integers are not rounded to floating-point precision.

Ready to convertEnter a number and select its bases

Input tips

  • Binary accepts only 0 and 1 (for example, 1101).
  • Octal accepts digits 0 through 7 (for example, 755).
  • Hexadecimal accepts digits 0–9 and letters A–F, in either case (for example, 1F or a3).
  • For hexadecimal input only, an optional 0x or 0X prefix is accepted. Binary 0b and octal 0o prefixes are not accepted by this form.
  • The input is limited to 4,096 digits. This tool accepts non-negative integers, not fractions or negative values.

How positional number systems work

Binary (base 2)

Uses the digits 0 and 1. Each position represents a power of 2. Computers encode information in digital states, and binary is a compact way to describe those values.

Octal (base 8)

Uses digits 0 through 7. Each octal digit corresponds to three binary digits, which makes octal a convenient shorthand for some bit patterns, including Unix-style permission values.

Decimal (base 10)

Uses digits 0 through 9 and is the everyday system most readers use. Each position represents a power of 10.

Hexadecimal (base 16)

Uses digits 0–9 and letters A–F. One hexadecimal digit represents exactly four binary digits, so long binary strings can be written more compactly.

Worked examples

  • Binary 1010 → decimal 10: 1×8 + 0×4 + 1×2 + 0×1 = 10.
  • Decimal 255 → hexadecimal FF.
  • Hexadecimal 3F → binary 111111 (or 0011 1111 when grouped into four-bit blocks).
  • Octal 755 → decimal 493: 7×64 + 5×8 + 5 = 493.

Where these bases are useful

  • Programming: bit masks, flags and address representations.
  • Electronics: digital states and register values.
  • Web design: hexadecimal color codes such as #FF6B35.
  • Operating systems: octal notation is commonly used to describe Unix file permission bits.
  • Base64 is a byte-to-text encoding, not a positional number base; use a text-encoding tool for that format.

Quick conversion table

DecimalBinaryOctalHexadecimal
81000108
15111117F
16100002010
64100000010040
25511111111377FF
1024100000000002000400

A quick manual method

To convert decimal to binary, divide repeatedly by 2 and read the remainders from bottom to top. For 13, the remainders are 1, 0, 1, 1, giving 1101. To convert binary to hexadecimal, group bits in sets of four from the right: 11010110 becomes 1101 | 0110, or D6.

Frequently asked questions

Why does 0x appear before some hexadecimal values?

It is a notation prefix used in many programming languages to mark base 16. For example, 0xFF represents 255. This form also accepts 0X. Prefixes 0b and 0o are not accepted by this input.

Can a number base be greater than 16?

Yes. Positional bases can use other digit alphabets. Base 36 uses 0–9 and A–Z in some compact identifiers and codes. This converter offers bases 2, 8, 10 and 16 only.

Can I convert negative or fractional values?

No. This converter accepts non-negative integers only. Fractions and negative values need a different representation and are outside this tool’s current scope.

Why is hexadecimal useful for binary values?

Each hexadecimal digit maps exactly to four bits. For example, D6 is 1101 0110 in binary. Grouping makes a long bit sequence easier to read without changing its value.

Technical reference

MDN — BigInt.prototype.toString()

Related tool

For text encoding such as Base64, see the text encoding tool.