Skip to content
Accessibility
Theme
Text size
High contrast
Limit animations
Readable fontAtkinson Hyperlegible
Increased text spacing
Underline links
Always show focus

Runs in your browser — nothing you paste is uploaded.

Number Base Converter

Convert an integer between binary, octal, decimal and hexadecimal. Auto-detects 0x/0o/0b prefixes and handles arbitrarily large integers. Runs in your browser.

Input is read in the selected base (Auto uses the prefix, else decimal).


    

What it does

Enter a whole number and see it at once in base 2 (binary), base 8 (octal), base 10 (decimal) and base 16 (hexadecimal). The four results update as you type and each is ready to copy. Negative numbers are supported — a leading - is carried through to every base.

Choosing the input base

In Auto mode the prefix decides: 0x means hexadecimal, 0o octal, 0b binary, and anything else is read as decimal. Pick an explicit base button to force the reading instead — in Hex mode ff is 255 with no prefix needed, and in Binary mode 1010 is 10. If you type a digit that doesn't belong to the chosen base (say 2 in binary, or g in hex) the tool flags exactly which character was invalid rather than guessing.

Big integers stay exact

Conversion uses JavaScript's BigInt, so values far beyond 2⁵³ keep every digit. Plain parseInt and Number.toString round large numbers silently, which quietly corrupts 64-bit IDs, permission bitmasks and hashes. Here the arithmetic is exact at any size.

Worked examples

  • Type 255 (Auto): Binary 11111111, Octal 377, Decimal 255, Hex ff.
  • Type 0b1010: the 0b prefix reads it as binary, giving Decimal 10 and Hex a.
  • Paste a large flag value like 0xDEADBEEFCAFEBABE and read off its exact decimal and binary forms for a bitmask check.

When to use it

Handy for reading a hex colour or byte value as decimal, inspecting a Unix file-mode or permission bitmask, decoding a hardware register, or sanity-checking a 64-bit identifier. For styling hex colours specifically, try the colour converter; for Unix permission bits, the chmod calculator.

Privacy

Everything runs locally; nothing is uploaded.

Frequently asked questions

Can it convert fractions or decimal points?

No. The converter works on whole integers only, because it uses BigInt for exact arithmetic. A value like 3.14 is not a valid integer and the decimal point is reported as an invalid digit. Convert the integer part on its own if you need it — fractional base conversion is a separate problem this tool doesn't cover.

Why use this instead of parseInt or toString?

JavaScript's Number loses precision above 2⁵³, so parseInt and Number.toString silently round large values such as 64-bit IDs, hashes and bitmasks. This tool parses with BigInt, keeping every digit exact in all four bases, and it shows binary, octal, decimal and hex together in one step.

What does Auto mode do with a prefix?

In Auto mode a leading 0x reads the value as hexadecimal, 0o as octal and 0b as binary; anything else is decimal. Pick an explicit base button instead and the input is read in that base with any prefix ignored, so ff in Hex mode is 255.

Related tools