DevKit

Number Base Converter

Convert between any two bases from 2 to 36, exact for arbitrarily large integers.

Free No sign-up Runs in your browser
Convert
Bit viewgrouped in bytes

Values are parsed with BigInt, so 64-bit and larger integers stay exact — no floating-point rounding.

Bases are just groupings of the same value

A number written in base b records how many groups of powers of b it contains. Decimal uses ten digits, binary two, octal eight, hexadecimal sixteen. 255, 11111111, 377 and FF are four spellings of one quantity.

Programmers live in hex because one hex digit maps exactly to four bits: FF is 1111 1111. That makes hex a compact, lossless way to read binary. Octal survives mainly in Unix file permissions (chmod 755), where each digit encodes three bits — read, write, execute.

Why use BigInt

JavaScript numbers are IEEE-754 doubles with 53 bits of integer precision. That is not enough for 64-bit ids, cryptographic values or large bitmasks — parseInt('7fffffffffffffff', 16) silently loses the low bits. This converter uses BigInt, so arbitrarily long integers convert exactly, including values beyond 64 bits.

Two's complement, briefly

Computers store negative integers in two's complement: invert every bit and add one. In 8 bits, -1 is 11111111 and -128 is 10000000. This is why a signed byte holds −128 to 127 while an unsigned one holds 0 to 255, and why overflow flips sign. A "-1" you see in a hex dump of a signed field is a different value from the unsigned 0xFF.

Bit twiddling you will actually use

  • x & (x - 1) clears the lowest set bit — used to check for powers of two.
  • x | (1 << n) sets bit n; x & ~(1 << n) clears it.
  • ~x + 1 negates in two's complement.
  • Shifting left by one is multiplying by two — but only until it overflows.

Reading hex dumps and color codes

Network packets, image headers and machine code are usually shown as hex bytes. Grouping into pairs — 48 65 6C 6C 6F — makes the ASCII mapping visible: that is "Hello". The same grouping habit makes #3D5AF1 readable as three color channels rather than six opaque characters.

Frequently asked questions

What is the largest number this handles?
There is no practical limit — parsing uses BigInt, so 128-bit, 256-bit and larger integers convert exactly. Only your browser's memory constrains it.
Can I convert negative numbers?
Yes, with a leading minus sign. The bit view shows the magnitude, not the two's complement representation, because the bit width is not defined until you choose one.
Why does my 64-bit hex value lose precision elsewhere?
Because parseInt and Number use doubles. In JavaScript use BigInt("0x..."); in SQL use a BIGINT or NUMERIC column, not a float.
What is base 36 used for?
Compact case-insensitive identifiers: digits plus letters, as in short URLs and YouTube-style ids. Base 32 is common too because it avoids ambiguous characters.

Related tools