Developer Runs locally Ready to use Built-in examples No tracking

Base Converter

Convert integers between binary, octal, decimal, hexadecimal and any base up to 36. Powered by BigInt so huge values never lose precision.

Base conversion moves integers between binary, octal, decimal, hexadecimal and beyond. Hexadecimal dominates memory addresses, colour values and byte representations in code; binary is how bit operations and permission flags are read; octal appears in file permissions (chmod 755). This tool handles any base from 2 to 36 and computes with BigInt, so very large integers lose no precision.

The arithmetic is simple enough: decimal to base N is repeated division with the remainders read in reverse, and because 2, 8 and 16 are powers of two they convert by grouping bits — one hexadecimal digit is four binary ones. One caveat: the representation of fractions differs between languages, so this tool focuses on exact conversion of integers.

How to use

  1. Enter the value and choose its base.
  2. Read the equivalents in every other base.
  3. Use the BigInt-backed output for values beyond the safe integer range.
  4. Remember binary, octal and hex group cleanly by bits.

How it works

The universal conversion method

The general method: to convert a decimal integer to base N, "divide by N, keep remainders, read them in reverse". For 255 to binary: 255÷2 = 127 remainder 1, keep dividing — the reversed remainders give 11111111.

Hex ↔ binary conversion

Hex and binary convert "one digit to four bits": F = 1111, so FF = 11111111 — no need to pass through decimal.

Precision for huge integers

This tool computes exactly with BigInt, so huge integers beyond Number.MAX_SAFE_INTEGER (like 2^100) never lose precision.

Code example

JavaScript Base conversion (including large integers)

// Common range
parseInt("ff", 16)   // 255
(255).toString(16)    // "ff"

// Beyond Number.MAX_SAFE_INTEGER, use BigInt
BigInt("0xffffffffffffffff")            // 18446744073709551615n
BigInt("18446744073709551615").toString(16) // "ffffffffffffffff"

Shell Base conversion on the command line

# Hex to decimal
printf "%d\n" 0xff

# Decimal to hex
printf "%x\n" 255

# Any base (bc)
echo "obase=16; 255" | bc

FAQ

Why is hex so common in programming?

One hex digit maps to exactly 4 binary bits, so a byte (8 bits) is two hex digits (0xFF = 255) — shorter than binary and more intuitive than decimal. Memory addresses, color values and MAC addresses all use it.

How do I convert binary fractions?

The fractional part uses "multiply by 2, keep the integer part", and many decimal fractions (0.1 among them) repeat forever in binary — the root of floating-point error. This tool handles integers only, to stay exact.

What's base 36 about?

Digits 0–9 plus the 26 letters make exactly 36 symbols, the maximum for this notation. Some short-link services compress long IDs into short strings with high bases this way.

Quick decimal-to-binary method?

"Divide by 2, keep remainders, reverse": keep dividing the quotient by 2 while recording remainders until the quotient hits 0, then read the remainders backwards. 13 → 1101 (13÷2 r1, 6÷2 r0, 3÷2 r1, 1÷2 r1, reversed).

Easiest conversion between binary, octal and hex?

Group directly without passing through decimal: binary → octal groups 3 bits, → hex groups 4 bits; reverse splits one octal digit into 3 bits and one hex digit into 4. FF = 11111111, and octal 377 = 11111111 too.

Do uppercase and lowercase hex letters differ?

No. A–F and a–f denote the same values, and languages and config files accept both. Convention: constants and addresses uppercase (0xFF), string output and hashes lowercase.

What do the 0x and 0b prefixes mean in code?

They're language literal prefixes: 0x hex (0xFF = 255), 0b binary (0b1010 = 10), 0o octal. When entering values here, strip the prefix and keep just the digits, or the prefix reads as an illegal character.