Number Base Converter

Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal and custom bases (2-36). Free online number system converter for programmers

Bases 2, 8, 10, and 16 cover 99% of programming work — but when you need to debug a permission bitmask, decode a color value bit by bit, or work in base-36 because Crockford Base32 was almost the right answer, you need a converter that handles arbitrary bases up to 36 and shows you the digit-by-digit math. This one does, in your browser, with no integer-size limits (uses BigInt under the hood, so 2^53 is not a wall).

What "base" actually means

A positional number system in base N uses N distinct digits and gives each position a weight of N^k. The number 255 in base 10 = 2×100 + 5×10 + 5×1. The same value in base 16 is FF = 15×16 + 15×1. The "digits" 0–9 are reused for bases ≤10; bases 11–16 add A–F; bases 17–36 continue through Z. Above 36, conventions diverge — Base58, Base62, and Base64 each have their own non-positional alphabets.

Base 2 is the only one where every digit is one bit. Base 8 groups bits in threes (one octal digit = 3 bits), base 16 groups in fours (one hex digit = 4 bits). This is why hex is preferred over octal for byte-aligned data — each byte is exactly two hex digits, no padding alignment math required.

Working example: a chmod value

Input

Decimal: 493
Convert to base 8

Output

493₁₀ = 755₈

Step by step:
  493 ÷ 8 = 61 remainder 5  → last digit
   61 ÷ 8 =  7 remainder 5  → middle digit
    7 ÷ 8 =  0 remainder 7  → first digit

Read remainders bottom-up: 7, 5, 5 → 755₈

As a chmod: 7 = rwx (owner), 5 = r-x (group), 5 = r-x (other)

In octal each digit is one rwx triplet. This is why chmod uses octal — the alignment is built in. 644 = rw-/r--/r--, 755 = rwx/r-x/r-x, 777 = rwx/rwx/rwx.

Useful bases beyond 2/8/10/16

  • Base 32 — used in Crockford Base32 (case-insensitive, no I/L/O/U to avoid confusion) for human-typeable IDs. Different from RFC 4648 Base32 — same alphabet length, different ordering, different padding.
  • Base 36 — alphanumeric 0-9 a-z. JavaScript Number.prototype.toString(36) produces it natively. Useful for short, URL-safe, human-readable IDs when collisions can be tolerated.
  • Base 58 — Bitcoin-style; removes 0, O, I, l. Not a positional base in the textbook sense — it is technically arithmetic-style but encoded against a custom alphabet.
  • Base 64 — not a positional base, it is a binary-to-text encoding. Three bytes in, four characters out. Do not confuse with "base 64 numbers" — those would need 64 digit symbols and the alphabet is not for arithmetic.

When to reach for this tool

  • You are reading a register dump and need to see what bits are set in 0xDEADBEEF — paste the hex, see the 32-bit binary, count the ones.
  • You are debugging a Unix file permission and need to confirm that 0o644 really is rw-r--r-- before chmod-ing in production.
  • You inherited code that stores feature flags as a decimal bitfield (37 = 0010 0101 = flags 0, 2, 5) and need to figure out which features are enabled.
  • You are interviewing a candidate and want a concrete "convert 0xCAFE to base 8" exercise that exercises division-with-remainder thinking.

What this tool will not do

  • It will not convert negative numbers in two's complement representation. -1 in binary is "negative one"; whether it is shown as -1 or as ...11111111 depends on the bit width you assume. Use a dedicated two's-complement viewer for hardware debugging.
  • It will not handle fractional bases. 0.1₁₀ ≠ 0.1₂ — there is no terminating binary representation of decimal 0.1. For floating-point bit inspection use an IEEE 754 visualizer instead of base conversion.
  • It will not parse "0x" / "0b" prefixes automatically in every field — pick the input base explicitly so the tool does not silently treat your hex as decimal.

Frequently asked questions

Why does my binary conversion show extra leading zeros?

Most converters pad to a byte (8 bits) or word (32/64 bits) boundary for readability. 5 in binary is 101 strictly, but 0000 0101 in 8-bit display. Both represent the same value — only the display width differs.

How do I convert a negative number to binary?

The textbook answer is sign-and-magnitude: prefix with "-". The useful answer is two's complement at a chosen bit width: -1 in 8-bit two's complement is 11111111. Pick the width first; representation depends on it.

What is the highest base I can use?

For positional bases with single-character digits 0-9A-Z, 36 is the natural maximum. Higher bases need multi-character digits or extended alphabets (Base 58, Base 62, Base 64) and are typically encodings, not positional numerals.

Why does JavaScript parseInt("08") give 0 in old browsers?

ES3 (pre-2009) treated leading-zero numbers as octal by default. parseInt("08") was 0 because 8 is not a valid octal digit. Modern parseInt requires the radix argument: parseInt("08", 10) = 8. Always pass the radix.

How do I quickly tell if a number is a power of 2?

Convert to binary. A power of 2 has exactly one bit set: 1, 10, 100, 1000, ... In code: n > 0 && (n & (n - 1)) === 0. This works in any base when converted to binary first.

Is there a difference between hexadecimal and "hex color" notation?

Hex colors are just hex numbers with a domain-specific interpretation. #FF0000 is the hex number 0xFF0000 = 16711680. The "#" is a CSS marker, not part of the number. Convert it normally.

Related tools

Last updated · E-Utils editorial team