← All tools

Number base converter

Convert between binary, octal, decimal and hexadecimal.

Binary
Octal
Decimal
Hex

How to use the number base converter

  1. Pick the base your number is in from the dropdown — decimal by default, or binary, octal, hex.
  2. Type or paste the value. Prefixes are optional: 0xFF, 0b1010 and 0o755 are stripped automatically.
  3. All four representations update live as you type — binary, octal, decimal and hex (shown uppercase) at once. Select any line to copy it.
  4. A digit that doesn't exist in the chosen base — a 9 in octal, a G in hex — shows “Not a valid base-N number” until corrected.
  5. Above 9,007,199,254,740,991 (2^53 − 1) a warning appears, because results past that point can lose precision.

Common uses

  • Translate a hex constant from a stack trace, error code or C header into decimal — or go the other way while writing one.
  • Decode Unix file permissions: octal 755 in binary is 111101101 — three rwx triplets you can read straight off.
  • Work with bitmasks and feature flags: convert a decimal flags value from an API to binary to see exactly which bits are set.
  • Hop between a color channel's hex byte (FF) and its decimal value (255) when adjusting RGB colors by hand.
  • Learn positional notation — watching all four bases react to each keystroke beats static textbook examples.

Tips & limitations

  • Unsigned integers only: no minus signs, no decimal points, no fractions. A register value like FFFFFFFF converts to 4,294,967,295 — the tool doesn't do two's-complement, so it won't tell you that's −1 as a signed 32-bit int.
  • Precision tops out at 2^53 − 1, JavaScript's safe-integer ceiling. Longer values — 64-bit hashes, snowflake IDs — still convert, but the low digits can round off; the warning tells you when you're in that zone.
  • Input is validated against the selected base, so switch the dropdown before pasting — hex CAFE under the default decimal setting just reads as invalid.
  • Prefix stripping is a convenience, not a mode switch: 0x, 0b or 0o is removed no matter which base is selected, so typing 0x2F in binary mode won't switch you to hex.

How it's built & why it's safe

Conversion is JavaScript's native parseInt(value, base) to read the number and toString(radix) to print it in each base — no library, no lookup tables, a couple dozen lines in total. It runs entirely in your browser, updates on every keystroke, and keeps working offline once the page has loaded. Nothing you type is sent or stored anywhere, and there's no server doing math on your behalf.

Related tools: Subnet Calculator · Color Converter · Unit Converter

Frequently asked questions

Which bases does it convert between?

Binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16), all shown simultaneously. You choose which base the input is in, and the other three are computed live as you type.

How big a number can it handle exactly?

Values up to 2^53 − 1, which is 9,007,199,254,740,991, convert exactly. Beyond that, JavaScript's floating-point numbers can't represent every integer, so a warning appears and the last digits may round — 64-bit values won't be bit-perfect.

Can it convert negative numbers or fractions?

No — input is limited to unsigned whole numbers, with no minus sign or decimal point. A hex value that represents a negative in two's-complement, like FFFF for −1 in 16 bits, converts as its plain unsigned value instead.

Why does it say my number isn't valid?

At least one character isn't a digit of the selected input base — a 2 in binary mode, an 8 in octal, a G in hex. Check that the dropdown matches the number you pasted; that mismatch causes most errors.

Do 0x and 0b prefixes work?

Yes — a leading 0x, 0b or 0o is stripped automatically, so pasting 0xDEADBEEF works as hex input. The prefix doesn't change the selected base, though: pick the right base in the dropdown as well.

Is anything sent to a server?

No — the math is a few lines of JavaScript running in the page, with no network requests, no storage and no account. Once the page has loaded, it works with no connection at all.