Convert between binary, decimal, hexadecimal, and octal number systems instantly. This free online number base converter supports radix conversion for any base from 2 to 36, with BigInt precision for arbitrarily large numbers. Explore positional notation across base-2, base-8, base-10, and base-16 numeral systems with grouped nibbles, bit-length display, and real-time input validation. All conversions happen client-side in your browser.
Number base conversion converts integers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Signed integers in binary use two's complement representation — the high bit indicates sign, and negative values are the bitwise inverse plus one. This free number base converter handles two's complement for negative numbers, missing from most online converters.
If you have ever stared at 0xDEADBEEF in a stack trace or typed chmod 755 without thinking about it, you are already using positional number systems. This guide unpacks why programmers care about base-2, base-8, and base-16 — what each one buys you, how the conversion math actually works, what "two's complement" means in practice, and the language-specific syntax you need so the same number reads the same in JavaScript, Python, Go, Rust, and C.
A number written in any base is a sum of digits multiplied by powers of that base. The decimal number 214 is 2×10² + 1×10¹ + 4×10⁰. Take the same idea and swap 10 for any other base:
1×2⁷ + 1×2⁶ + 0×2⁵ + 1×2⁴ + 0×2³ + 1×2² + 1×2¹ + 0×2⁰ = 128 + 64 + 16 + 4 + 2 = 214.3×8² + 2×8¹ + 6×8⁰ = 192 + 16 + 6 = 214.13×16¹ + 6×16⁰ = 208 + 6 = 214.Notice that 214 has eight binary digits, three octal digits, three decimal digits, and two hex digits. Higher bases are denser — that is why programmers prefer hex over binary for byte-level work.
| Base | Digits | Where you see it |
|---|---|---|
| Binary (2) | 0, 1 | Bit flags, hardware registers, network masks, low-level protocols. |
| Octal (8) | 0–7 | Unix file permissions (chmod 755), legacy PDP-11 systems, some C string escapes (\137). |
| Decimal (10) | 0–9 | Human-readable numbers, financial values, anything user-facing. |
| Hexadecimal (16) | 0–9, A–F | Memory addresses, RGB color (#FF5733), MAC addresses, JWT signatures, hashes, byte dumps. |
| Base-32 / Base-36 | 0–9, A–V or A–Z | Crockford base32 in ULIDs, base36 in short-link IDs. |
| Base-58 | Bitcoin alphabet (no 0, O, I, l) | Bitcoin addresses, Solana keys. |
| Base-64 | A–Z, a–z, 0–9, +, / | Embedding binary in text (data URIs, basic auth, JWT body). |
Octal feels archaic, but every Unix admin uses it daily — chmod 644 file sets permissions to 110 100 100 in binary (rw- r-- r--).
Computers store integers as fixed-width bit patterns. The trick to representing negative numbers is two's complement: the most-significant bit's place-value is negated. In an 8-bit signed integer, the leftmost bit's value is −128 instead of +128:
| Binary (8 bits) | Unsigned | Signed (two's complement) |
|---|---|---|
| 00000000 | 0 | 0 |
| 00000001 | 1 | 1 |
| 01111111 | 127 | 127 |
| 10000000 | 128 | −128 |
| 11111111 | 255 | −1 |
To negate a two's-complement number: invert every bit, then add 1. So +5 = 00000101, invert → 11111010, +1 → 11111011 = −5. The reason this encoding won is that addition and subtraction work the same circuit regardless of sign — no special case for negatives.
| Operator | Effect | Use it for |
|---|---|---|
& AND | 1 only when both bits are 1 | Mask: keep specific bits, drop the rest. x & 0xFF = low 8 bits. |
| OR | 1 when either bit is 1 | Set bits: flags | READ turns on READ. |
^ XOR | 1 when bits differ | Toggle bits, simple cipher round, parity check. |
~ NOT | Flip every bit | Bitmask building: ~0xFF clears low byte. |
<< shift left | Multiply by 2 per shift | Build a single-bit mask: 1 << 7 = bit 7. |
>> shift right (arithmetic) | Divide by 2; preserves sign bit | Sign-aware integer division by powers of 2. |
>>> shift right (logical, JS) | Divide by 2; fills with 0 | Treating the value as unsigned. |
The same number can fit in 8, 16, 32, or 64 bits, with different limits at each width. The four widths you will see most:
| Type | Bits | Unsigned range | Signed range |
|---|---|---|---|
| byte / uint8 | 8 | 0 to 255 | −128 to 127 |
| short / int16 | 16 | 0 to 65 535 | −32 768 to 32 767 |
| int / int32 | 32 | 0 to 4 294 967 295 | −2 147 483 648 to 2 147 483 647 |
| long / int64 | 64 | 0 to 18.4 × 10¹⁸ | −9.22 × 10¹⁸ to 9.22 × 10¹⁸ |
The classic int32 overflow: Math.pow(2, 31) - 1 in 32-bit signed wraps to −2 147 483 648 if you add 1. JavaScript number conversions to int32 (x | 0) hit this, and so does every SELECT count(*) on a table with billions of rows in a 32-bit-id schema. Use 64-bit types for anything that can grow.
| Language | Binary | Octal | Hex | Underscores |
|---|---|---|---|---|
| JavaScript / TypeScript | 0b1101 | 0o755 | 0xDEAD | Yes (1_000_000) |
| Python 3 | 0b1101 | 0o755 | 0xDEAD | Yes |
| Go | 0b1101 | 0o755 | 0xDEAD | Yes (Go 1.13+) |
| Rust | 0b1101 | 0o755 | 0xDEAD | Yes |
| Java 7+ | 0b1101 | 0755 (no o) | 0xDEAD | Yes |
| C / C++14+ | 0b1101 | 0755 | 0xDEAD | Yes (C++14: 1'000'000) |
| Ruby | 0b1101 | 0755 or 0o755 | 0xDEAD | Yes |
| SQL (Postgres) | B'1101' | — | x'DEAD' | — |
The bare-leading-zero octal in C, C++, Java, Ruby (0755) is a historical hazard. parseInt("08") in old JavaScript returned 0 because of it; ES5 fixed that, but the lesson is to write 0o explicitly.
0x10 is 16, not 10. Browser DevTools' "Memory" panel shows offsets in hex; mismatching it with decimal byte counts is a classic off-by-six bug.0xFFFFFFFF | 0 is −1, not 4 294 967 295. For 64-bit arithmetic, use BigInt.parseInt(str) without a radix. Some older runtimes guess the base from a leading 0 or 0x. Always pass the radix: parseInt(str, 10), parseInt(str, 16).chmod 755 = octal 755 = binary 111 101 101 = rwx r-x r-x. Do not write chmod 0x755.=) and 6-bit grouping have no analog in base-2/8/10/16.Search results for "binary to decimal", "hex converter", "number base converter" return many tools but most fail on real-world numbers: they cap at 32-bit (silently truncating large values), they don't handle two's complement for negative numbers, they only support binary/octal/decimal/hex (skipping base32, base36, base58 for crypto), or they don't display the bit-length / grouped-nibble formatting needed for low-level debugging. Here's how the most-used base converters compare in 2026:
| Tool | BigInt (no precision loss) | Bases supported | Two's complement | Bit length display | Cost |
|---|---|---|---|---|---|
| FreeDevTool Number Base | Yes | 2 through 36 | Yes | Yes (with grouping) | Free |
| rapidtables.com/convert/number | 32-bit limit | Bin/Oct/Dec/Hex | No | No | Free, ad-funded |
| binaryhexconverter.com | Limited | Bin/Oct/Dec/Hex | No | No | Free, ad-heavy |
| Windows Calculator (Programmer mode) | 64-bit | Bin/Oct/Dec/Hex | Yes | Yes | Built-in |
JavaScript parseInt(str, base) | 53-bit float | 2-36 | Manual | Manual | Built-in |
Python int(str, base) | Arbitrary precision | 2-36 | Manual | Manual | Built-in |
Type your binary number in the binary input field — decimal, octal, and hex update instantly. The converter uses JavaScript BigInt internally so a 200-bit binary number converts without precision loss (unlike parseInt which silently rounds past 53 bits). For binary like 11010110: type or paste the digits, see decimal 214, hex 0xD6, octal 0o326 instantly. For hex with prefix: type 0xDEADBEEF or just DEADBEEF — both parse. The bit-length indicator shows the minimum bits required (8 bits for 0xD6, 32 bits for 0xDEADBEEF) which matters for fixed-width register debugging.
| Base | Digits used | Common use |
|---|---|---|
| Binary (2) | 0, 1 | Bitwise ops, low-level memory representation |
| Octal (8) | 0-7 | Unix file permissions (chmod 755) |
| Decimal (10) | 0-9 | Default human notation |
| Hexadecimal (16) | 0-9, a-f | Color codes (#FF0000), memory addresses, byte representation |
| Base32 (Crockford) | 0-9, a-z minus i, l, o, u | ULID, AWS S3 ARN, human-typeable IDs |
| Base36 | 0-9, a-z | Compact alphanumeric IDs, short URL slugs |
| Base58 (Bitcoin) | 1-9, A-Z, a-z minus 0/O/I/l | Bitcoin/Monero addresses, short IDs |
| Base64 | A-Z, a-z, 0-9, +, / | Binary-to-text encoding (use Base64 Encoder) |
Decision rule: bitwise debugging → binary. Linux file perms → octal. Color/memory/byte → hex. Database short IDs → base36. Crypto / Bitcoin → base58. Binary blob in JSON → base64 (different operation, see Base64 Encoder).
-1 and see the two's-complement bit pattern at any bit-width (8/16/32/64) — useful for embedded systems and bit-flag debugging.Pair the number base converter with the Hex to RGB Converter for color work, the Chmod Calculator for octal Unix permissions, the Byte Converter for KB/MB/GB conversion, and the Encoding Tools hub for the broader transform toolkit.
1011 = (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2&sup0;) = 8 + 0 + 2 + 1 = 11 in decimal. This positional notation principle applies to all numeral systems — the digit value is multiplied by the base raised to its position index.
0–9 and letters A–F. Each hex digit maps to exactly 4 binary bits (a nibble), making it a compact way to represent binary data. For example, 0xFF = 11111111 in binary = 255 in decimal. Programmers use hex for memory addresses, color codes, byte values, and bitwise operations because it is far more readable than long binary strings while maintaining a direct relationship with the underlying binary system.
000, 1=001, 2=010, 3=011, 4=100, 5=101, 6=110, 7=111. For example, octal 357 = 011 101 111 in binary. To go from binary to octal, group binary digits into sets of 3 from the right and convert each group to its octal equivalent.
11111111 is 255 when unsigned, but −1 in signed two's complement. Understanding this distinction is crucial for low-level programming and bitwise operations in languages like C and Rust.
All tools run in your browser, no signup required, nothing sent to a server.