🛠️ Developer & Web

Number Base Converter

Type in any box — binary, decimal, hex and octal update together.

  • 4 + 1fixed bases plus any 2–36
  • BigIntexact for huge numbers
  • 0x · 0b · 0oprefixes accepted
  • Bit countshown as you type

How to use the Number Base Converter

  1. 1

    Type in the box you know

    Enter a number in decimal, binary, hexadecimal, octal or the custom-base box. All other boxes update as you type.

  2. 2

    Use prefixes or separators freely

    0x, 0b and 0o are stripped in their own boxes, and spaces or underscores such as 1111_0000 are ignored.

  3. 3

    Set a custom base

    Choose any base from 2 to 36 for the fifth box; base 36 uses 0–9 then a–z.

  4. 4

    Check the bit count

    The status line shows how many bits the number needs, or names the first invalid digit.

Features

No size limit in practice

JavaScript BigInt keeps every digit exact, far beyond 253.

Negative numbers

A leading minus sign is kept, so −42 becomes −101010 in binary.

Case-insensitive input

ff, FF and 0xFf all work; hex output is uppercase.

Any base 2–36

Handy for base 3, base 12, base 32 or base 36 puzzles and IDs.

Clear errors

Typing a digit that does not exist in that base names the offending character.

Instant and local

Conversion runs in your browser; nothing is sent anywhere.

Who uses it — and for what

Students

Check computer-science and digital-electronics homework.

Programmers

Decode error codes, bit flags, masks and memory addresses.

Network engineers

See IP octets and subnet masks as binary.

Designers

Turn hex colour components into decimal 0–255 values.

How number bases work

A number base says how many digits are used before you carry to the next place. Decimal uses ten (0–9). Binary uses two (0 and 1) and is how computers store everything. Hexadecimal uses sixteen (0–9 then A–F) and is a compact way to write binary — each hex digit is exactly four bits, so the byte 11111111 is FF, or 255 in decimal. Octal (0–7) is still used for Unix file permissions like 755.

Where you will see them

  • Hex colour codes: #FF8800 is red 255, green 136, blue 0.
  • Memory addresses and error codes, e.g. 0x80070005.
  • Network masks: 255.255.255.0 is 24 ones in binary.
  • Base 36 (0–9 and A–Z) for short IDs and URL shorteners.

The converter uses arbitrary-precision BigInt maths, so it handles numbers far larger than 253 without rounding. Prefixes such as 0x, 0b and 0o are accepted, as are negative numbers.

Converting by hand, step by step

Any base to decimal: multiply each digit by the base raised to its position, counting from 0 on the right. Hex 2A = 2 × 16 + 10 = 42. Binary 101010 = 32 + 8 + 2 = 42.

Decimal to any base: divide repeatedly by the base and read the remainders from bottom to top. 42 ÷ 8 = 5 remainder 2, 5 ÷ 8 = 0 remainder 5, so 42 is 52 in octal.

Binary ↔ hex and octal shortcuts: because 16 = 24 and 8 = 23, you can convert without going through decimal. Group binary digits in fours from the right for hex (1111 1111 → F F) or in threes for octal (11 111 111 → 3 7 7). That is exactly what the converter shows for 255: FF and 377.

Signed numbers and two’s complement

The converter shows negative numbers with a minus sign: −42 is -101010 in binary and -2A in hex. Computers usually store negatives differently, using two’s complement in a fixed width. In 8 bits, −42 is stored as 11010110 (D6); in 32 bits it is FFFFFFD6.

To get the two’s-complement pattern with this tool, add 2n to the negative number, where n is the width. For 8 bits, −42 + 256 = 214, and typing 214 gives 11010110 / D6. Going the other way, if a hex value has its top bit set (first hex digit 8–F for the width you care about), subtract 2n to read it as signed. That is how 0x80070005 (2,147,942,405) becomes −2,147,024,891.

WidthUnsigned maxSigned range
8-bit255 (FF)−128 to 127
16-bit65,535 (FFFF)−32,768 to 32,767
32-bit4,294,967,295 (FFFFFFFF)−2,147,483,648 to 2,147,483,647
64-bit18,446,744,073,709,551,615about ±9.22 × 1018

What the converter does not do

  • Fractions: only whole numbers are supported. A decimal point is reported as an invalid digit. Fractional binary (like 0.1) generally needs rounding and is better handled by a floating-point tool.
  • Prefixes in the wrong box: 0x is only removed in the hex box. Typing 0x1F into decimal gives the error “x is not a valid base-10 digit”.
  • Letters above the base: in base 16, g is rejected; in base 12, only 0–9, a and b are allowed.
  • Text encoding: to see the binary or hex bytes of words, use a text-to-binary or hex to text converter instead — this tool converts numeric values.

Worked examples

A Windows error code

Type 0x80070005 in the hex box. Decimal shows 2147942405, binary 10000000000001110000000000000101, octal 20001600005, and the status says 32 bits. The top bit set is why this “access denied” code is often printed as a negative number (−2147024891) by tools that treat it as a signed 32-bit integer.

A number JavaScript cannot hold exactly

Type 9007199254740993 (253 + 1) in decimal. The converter gives hex 20000000000001 and a 54-bit binary value ending in …0001. Plain JavaScript Number('9007199254740993') returns 9007199254740992 — off by one — because ordinary numbers only hold 53 bits of precision. BigInt avoids that.

Words in base 36

Set the custom base to 36 and type youtube: decimal shows 75513568442 and hex 1194F59CBA (37 bits). Base 36 is a compact way to write large numbers with only letters and digits, which is why some short-link services and ID schemes use it.

Pro tips

  • Paste long binary with spaces or underscores for readability — they are ignored.
  • For colours, convert each two-digit hex pair separately: #1E90FF → 30, 144, 255.
  • If your result looks off by one at around 16 digits, the source probably rounded it with ordinary floating-point numbers.

Glossary

Radix
Another word for base — the number of distinct digits in a positional number system.
Bit
A single binary digit, 0 or 1.
Two’s complement
The standard way computers store negative integers in a fixed number of bits.
BigInt
A JavaScript type for integers of any size without rounding.

Frequently asked questions

What is 255 in binary?

11111111 — eight ones, the largest value in one byte.

How do I convert hex to decimal?

Type the hex value (with or without 0x) in the hexadecimal box.

Does it support large numbers?

Yes, using BigInt — hundreds of digits work exactly.

What is FF in decimal?

255. Each F is 15, so 15 × 16 + 15 = 255.

Why does hex output appear in capitals but custom-base output in lowercase?

The hex box uses the conventional uppercase A–F; the custom box uses JavaScript’s standard lowercase digits for bases up to 36. Input in either case is accepted.

Can I convert a decimal fraction like 0.5?

No, the converter works with whole numbers only.

Found it useful? Share the Number Base Converter:

Last updated 2026-11-28 · Built by Vinayak Agarwal · Part of Developer & Web (77 tools)