Number Base Converter — Binary, Hex, Decimal & Octal

Type a number in any base and see it in all the others instantly. Inspect signed 8–64-bit two’s complement, flip bits, and convert text to hex or binary.

Runs in your browser
Options

Prefixes like 0x, 0b, 0o, spaces and underscores are ignored. Arbitrarily large integers are supported.

Two’s complement bit view
255
Signed value
255
Unsigned value
0x000000FF
Hex (fixed width)

Click a bit to flip it. The highlighted bit is the sign bit.

Text ↔ hex ↔ binary (UTF-8)

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the Number Base Converter

  1. Type a number into any field — decimal, hex, binary, octal or the custom base (2–36). All other fields update as you type.
  2. Negative numbers work with a leading minus; very large numbers are handled exactly with BigInt.
  3. Choose 8, 16, 32 or 64 bits in the bit view to see the two’s complement representation, signed and unsigned values. Click bits to flip them.
  4. Use the Text ↔ hex ↔ binary panel to encode text as UTF-8 bytes or decode hex/binary back into text.

What is a number base?

A number base (or radix) is how many distinct digits a positional number system uses. Decimal uses ten (0–9), binary two (0–1), octal eight (0–7) and hexadecimal sixteen (0–9 and A–F). Each position is worth the base raised to a power, so hex 2F means 2 × 16 + 15 = 47, and binary 101 means 1 × 4 + 0 × 2 + 1 = 5. Bases up to 36 use the letters A–Z as digits, which is how short IDs and URL shorteners squeeze large numbers into a few characters.

How to convert between bases

To decimal: multiply each digit by its place value and add them up — binary 1101 = 8 + 4 + 0 + 1 = 13. From decimal: repeatedly divide by the target base and read the remainders from bottom to top — 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1 → 1101. Binary and hex convert directly because one hex digit is exactly four bits: 1111 1010 = FA. Octal maps to groups of three bits, which is why Unix permissions like 755 are written in octal (111 101 101 = rwx r-x r-x).

DecimalBinaryOctalHex
10101012A
2551111 1111377FF
1024100 0000 00002000400
655351111 1111 1111 1111177777FFFF

Two’s complement and signed integers

Computers store negative integers in two’s complement: invert all bits of the positive value and add one. In 8 bits, 5 is 00000101 and −5 is 11111011 (hex FB, which is 251 when read as unsigned). The highest bit acts as the sign bit, so an 8-bit signed integer ranges from −128 to 127, 16-bit from −32,768 to 32,767, 32-bit from −2,147,483,648 to 2,147,483,647 and 64-bit up to about ±9.22 × 1018. Values outside the range wrap around — the classic integer overflow. The bit view above shows both interpretations of the same bits.

Large numbers and JavaScript

JavaScript’s regular numbers are 64-bit floats and lose precision above 253 − 1 (9,007,199,254,740,991). This converter uses BigInt, so 64-bit IDs, hashes and huge values convert exactly. To encode bytes as text instead of numbers, see the Base64 Encoder; for colour codes like #4F46E5, the Color Converter turns hex into RGB and HSL.

Tools that pair well with the Number Base Converter

  • Hash Generator — Compute MD5 and SHA hashes of any text or file instantly, create HMAC signatures, and paste an expected checksum to verify a download.
  • Unit Converter — Convert between metric, imperial and technical units in ten categories — with a two-way converter and a table of every unit at once.
  • URL Encode / Decode — Percent-encode text for safe use in URLs, decode encoded strings back to readable text, and break any URL down into its parts and query parameters.
  • Percentage Calculator — Seven everyday percentage calculations on one page.

Frequently asked questions

How do I convert binary to decimal?
Multiply each bit by its power of two, starting with 1 on the right, and add the results. 10110 = 16 + 0 + 4 + 2 + 0 = 22. Or paste it into the Binary field above.
How do I convert hex to decimal?
Multiply each hex digit (A=10 … F=15) by 16 to the power of its position: 1F4 = 1 × 256 + 15 × 16 + 4 = 500.
What is two’s complement?
The standard way to store signed integers: a negative number is the bit-inverted positive value plus one. It lets CPUs use the same addition circuit for signed and unsigned numbers.
Why does −1 show as FFFFFFFF?
In 32-bit two’s complement, −1 has every bit set, which is FFFFFFFF in hex or 4,294,967,295 when interpreted as unsigned.
How do I convert text to binary?
Type it in the Text box of the bottom panel. Each character is encoded as UTF-8 bytes and shown as 8-bit binary groups — “A” is 01000001. Non-ASCII characters such as “é” use two or more bytes.

Related tools