Skip to content

Number base converter

Convert an unsigned whole number between base 2, 8, 10, and 16 without losing large integer digits.

BIN ↔ OCT ↔ DEC ↔ HEX

Convert an integer

Your data stays in this browser.

Use digits valid for the selected base, without a sign, prefix, separator, or decimal point. Maximum 4,096 digits.

FF

255 (base 10) is equivalent to

How to use the number base converter

  1. Enter the unsigned whole number you already have. Choose its current numeral system under Source base: binary, octal, decimal, or hexadecimal.
  2. After editing the integer, select Convert number to apply it. Once that value is converted, changing either base updates the read-only result immediately without another confirmation. Every integer digit is kept even beyond JavaScript’s Number safe range.
  3. Use Swap bases to reverse a completed conversion. The exact result becomes the next source value, which makes a round-trip check quick and avoids retyping a long integer.
  4. Choose Copy result to copy a plain-text equation containing both values and both base numbers. You can paste it into notes, source comments, a worksheet, or a support ticket.

How positional number systems work

A base tells you how many digit values a positional numeral system has. Binary uses 0 and 1; octal uses 0 through 7; decimal uses 0 through 9; hexadecimal adds A through F for values ten through fifteen. A digit’s contribution is its value multiplied by the base raised to its position, counting from zero at the right. For example, hexadecimal 2F means 2 × 16¹ + 15 × 16⁰, which is decimal 47.

To express the same integer in another base, the converter repeatedly obtains destination-base digits from the exact integer value. Binary, octal, and hexadecimal line up especially well: one octal digit corresponds to three binary digits, and one hexadecimal digit corresponds to four binary digits. This is why hex is a compact way to write long bit patterns while preserving the same unsigned magnitude.

The calculation uses JavaScript BigInt rather than Number. Number can no longer distinguish every adjacent integer above 9,007,199,254,740,991; BigInt keeps arbitrary-size integer arithmetic exact within the page’s fixed input limit. The converter parses each valid source digit and produces the destination digits without passing through floating-point arithmetic.

Leading zeroes do not change an integer’s value, so the result is normalized to one zero for zero or begins with a nonzero digit. Hexadecimal letters are accepted in either case and displayed as uppercase. These presentation choices change the spelling of the numeral, not the represented value.

Worked conversion examples

Example 1: decimal 255 to hexadecimal

Enter 255, keep Decimal (base 10) as the source, and choose Hexadecimal (base 16). The result is FF because 255 = 15 × 16 + 15. Each F represents the digit value fifteen. Swapping the bases converts FF back to 255 exactly.

Example 2: a large binary integer beyond Number safety

Enter 100000000000000000000000000000000000000000000000000001 in binary and convert it to decimal. The result is 9,007,199,254,740,993 written without separators as 9007199254740993. That value is two above the Number safe-integer limit, but this converter preserves it exactly and converts it back to the original binary digits.

When base conversion is useful

Input rules and limitations

All supported number-base conversion directions

Conversion directionMethodExact example
Binary to Octal (bin to oct)Read in base 2; then write in base 8.1010102 = 528
Binary to Decimal (bin to dec)Read in base 2; then write in base 10.1010102 = 4210
Binary to Hexadecimal (bin to hex)Read in base 2; then write in base 16.1010102 = 2A16
Octal to Binary (oct to bin)Read in base 8; then write in base 2.528 = 1010102
Octal to Decimal (oct to dec)Read in base 8; then write in base 10.528 = 4210
Octal to Hexadecimal (oct to hex)Read in base 8; then write in base 16.528 = 2A16
Decimal to Binary (dec to bin)Read in base 10; then write in base 2.4210 = 1010102
Decimal to Octal (dec to oct)Read in base 10; then write in base 8.4210 = 528
Decimal to Hexadecimal (dec to hex)Read in base 10; then write in base 16.4210 = 2A16
Hexadecimal to Binary (hex to bin)Read in base 16; then write in base 2.2A16 = 1010102
Hexadecimal to Octal (hex to oct)Read in base 16; then write in base 8.2A16 = 528
Hexadecimal to Decimal (hex to dec)Read in base 16; then write in base 10.2A16 = 4210

Frequently asked questions

Why is hexadecimal FF equal to decimal 255?

The left F is fifteen sixteens and the right F is fifteen ones: 15 × 16 + 15 = 255. In binary, the same value is 11111111.

Can I enter lowercase hexadecimal letters?

Yes. Letters a through f are accepted and normalized to uppercase in the displayed and copied result.

Why did my leading zeroes disappear?

Leading zeroes do not change the unsigned integer. The converter returns a normalized numeral. If fixed-width padding is meaningful for a protocol or file format, add the required padding after checking that format’s specification.

Are very large integers rounded?

No. Valid inputs are parsed and converted with BigInt, so every integer digit is preserved up to the 4,096-character input limit. No floating-point Number conversion is used.

Does hexadecimal input mean text or a color?

No. It is treated only as an unsigned integer. The tool does not decode bytes as characters, split RGB channels, infer a memory width, or apply signed two’s-complement rules.