Number Base Converter

Hex, binary, octal, and decimal, with 0x, 0b, and 0o prefixes

Binary (2)
—
Octal (8)
—
Decimal (10)
—
Hexadecimal (16)
—
Base 36 (36)
—

About Number Base Converter

This page shows how the converter reads programming notation. Paste a value the way source code writes it, such as 0xFF, 0b1010, or 0o17, with _ digit separators as in 0xFFFF_FFFF, set From base to match, and read binary, octal, decimal, and hexadecimal at once, plus a fifth result for any other base up to 36 that you pick. The arithmetic uses BigInt, so a value like 0xFFFF_FFFF_FFFF_FFFF stays exactly 18446744073709551615 instead of being rounded. A negative value keeps its minus sign; two's complement is not computed. Results update on every keystroke, computed with BigInt arithmetic in this page.

Example

The largest unsigned 64-bit value, typed with its prefix and separators, From base set to Hexadecimal (16):

Value

0xFFFF_FFFF_FFFF_FFFF

Results

Binary (2)        1111111111111111111111111111111111111111111111111111111111111111
Octal (8)         1777777777777777777777
Decimal (10)      18446744073709551615
Hexadecimal (16)  FFFFFFFFFFFFFFFF
Base 36 (36)      3W5E11264SGSF

How to convert hex, binary, and octal

  1. 1Set "From base" to the base your value is written in, for example "Hexadecimal".
  2. 2Type or paste the value in "Value"; a matching prefix such as 0xFF, 0b101, or 0o17 and _ separators are accepted.
  3. 3Read binary, octal, decimal, and hexadecimal at once, and pick an extra base in "Also convert to".
  4. 4Click "Copy" under a result to copy that value.

Formats and limits

Input
Digits 0-9 then A-Z up to the chosen base, an optional sign, one point; _ and spaces ignored; prefixes as in 0b101, 0o17, and 0xFF for bases 2, 8, and 16
Output
Binary, octal, decimal, hexadecimal, and a fifth card when Also convert to holds another base; uppercase letters unless you uncheck them
Integer size
The code sets no digit cap: integers are exact BigInt values
Point
Accepted once; a result that does not end shows its first 40 digits, then …

Where your numbers are processed

Conversion happens in this page with exact integer arithmetic run by your browser, so the values you type are not sent to our servers. The results are page text: if you turn on a translation in the language menu, Google receives them. When the clipboard refuses a copy, we receive that error, the tool's name, and your browser's name and version, not your value.

Frequently asked questions

How do I convert hex to binary?

Set From base to Hexadecimal and type the value, with or without its prefix, as in 0x0F or 0F. The Binary card shows the result at once, without leading zeros: 0x0F gives 1111.

Can I get FFFFFFFF for -1?

No. The converter writes -1 as -1 in hex, keeping the minus sign in every base, because a bit pattern such as FFFFFFFF depends on a register width that it never asks for. For an eight-digit hex pattern, add 4294967296 (2^32) to the negative value first: -1 then gives FFFFFFFF.

Can it handle values above 2^64?

Yes. It works with BigInt, so 2^64, written 0x1_0000_0000_0000_0000, converts to 18446744073709551616 exactly, and larger values work the same way. A JavaScript Number would round them.

Why do I get Not a number in base 16?

The value has a character outside that base's digits, such as G in hex, or a prefix that belongs to another base, such as 0x10 with Binary selected. Below the field, the alert lists what base 16 allows: 0123456789…F.

Tips and tricks

  • ✓Uncheck "Uppercase letters" to match code that prints hex in lower case, such as Python's hex().