Number Base Converter
Convert numbers between binary, octal, decimal, hex, and any base 2–36
Underscores are allowed as digit separators (1_000_000, 1010_1010). Prefixes 0x, 0o, and 0b work when they match the input base.
How to Number Base Converter Online
Convert any integer between binary, octal, decimal, hexadecimal, and any base from 2 to 36.
- Type or paste the number you want to convert into the input field. Underscores work as digit separators (`1_000_000`).
- Pick the input base from the dropdown. Common choices are 2, 8, 10, and 16; any base from 2 to 36 is supported.
- For base 2, 8, and 16 you can use the standard prefixes `0b`, `0o`, and `0x` (the prefix must match the chosen base).
- Read off the conversions in all four standard bases plus the bit/byte width below.
- Use the "Arbitrary base" field at the bottom to see the value in any base from 2 to 36 — useful for base-36 short IDs, base-12 (duodecimal), or one-off needs.
- Click the Copy button next to any row to grab that representation.
About Number Base Converter
Numbers are the same value no matter how you write them — they only look different. `255`, `0xff`, `0b11111111`, and `0o377` are four different spellings of the integer two hundred fifty-five. The "base" of a numeral system is just how many distinct digits it uses before rolling over to the next column. Base 10 (decimal) uses 0–9 because we have ten fingers. Base 2 (binary) uses 0–1 because transistors are off or on. Base 16 (hexadecimal) uses 0–9 and a–f because four binary digits pack neatly into one hex digit, so any binary string can be displayed in hex at one-quarter the length without losing any information.
Most programmers spend their lives in a handful of bases. **Binary** for thinking about bit-fields, flags, and individual hardware registers. **Octal** for Unix file permissions (`chmod 755`) and a handful of legacy formats. **Decimal** for everything humans read. **Hexadecimal** for memory addresses, MAC addresses, color values (`#ff7700`), checksum/hash output, and any binary blob displayed in a hex editor. The converter shows all four side by side so you can spot patterns: `0xff` is `11111111` is "all bits set in one byte" is `377` octal is `255` decimal. Internalizing those equivalences saves real time when reading hex dumps.
The conversion logic uses **BigInt** rather than the standard JavaScript number, which matters more than it sounds. JavaScript numbers are 64-bit floats and can only represent integers exactly up to 2⁵³ ≈ 9 × 10¹⁵. A 64-bit hex value like `0xdeadbeefcafef00d` exceeds that, and naive conversion produces wrong decimal output. With BigInt, the converter handles arbitrary-precision integers — feed it a 1,000-digit number and it converts exactly. The cost is a tiny amount of CPU; the benefit is correctness on every real input.
A few input conveniences. **Underscore separators** are allowed and ignored: `1_000_000` parses as one million, `1010_1010` parses as the binary byte. **Standard prefixes** work: `0x` for base 16, `0b` for base 2, `0o` for base 8, when they match the chosen input base. Mismatched prefixes (asking the tool to read `0xff` as base 10) produce a clear error rather than silently misinterpreting the input. **Negative values** carry a minus sign and convert the magnitude — if you need a specific bit-width two's complement representation of a negative integer, the modular arithmetic is `(2^n - |value|)` for n bits.
The "arbitrary base" field lets you target any base from 2 to 36. Base 36 is the practical maximum for a generic converter, because that is when every digit and every letter is used exactly once. Beyond 36, encodings like **Base58** (Bitcoin addresses, which deliberately omit visually-confusable characters like `0`, `O`, `I`, and `l`) and **Base64** (RFC 4648, used for binary-to-text encoding in email and URLs) require curated alphabets and are not interchangeable with raw arbitrary bases — for those, use the dedicated Base64 tool.
All conversions run in your browser using `BigInt` and a tiny pure helper (under 1 KB). No network requests, no logging.
Related Tools
Frequently Asked Questions
Why are the digits in base 16 a–f?
A base-N system needs N distinct symbols. Base 10 has 0–9. Base 16 needs six more digits beyond 9, and the convention since the 1950s has been to reuse the first six letters of the alphabet: a=10, b=11, c=12, d=13, e=14, f=15. The same pattern extends up to base 36, which uses every letter. Beyond 36 there is no universal convention — some systems use mixed case for base 62 (Bitcoin addresses), others use entirely different alphabets (Base58, Base64).
Why use base 16 (hex) at all when computers think in base 2?
Because each hex digit corresponds to exactly 4 binary digits (a "nibble"). That makes binary trivially readable in hex: `0xff` is two hex digits and exactly 8 bits — one byte. `0xdeadbeef` is 32 bits — a word. This 1:4 mapping is why hex is the universal display format for memory addresses, color codes, MAC addresses, and binary data dumps.
What is the difference between `0x`, `0o`, and `0b` prefixes?
They are programming-language conventions adopted into many standards: `0x` means hexadecimal (used by C, Java, JavaScript, Python, Rust, Go), `0o` means octal (Python 3, JavaScript ES6, Rust), and `0b` means binary (Python, JavaScript ES6, Rust). Older C used a leading `0` for octal — so `0755` meant 493 decimal — which has caused enough silent bugs that the modern `0o` prefix is now preferred everywhere.
Why does the tool use BigInt instead of regular numbers?
Because JavaScript numbers are double-precision floats (IEEE 754) with only 53 bits of integer precision. The number 9007199254740993 (2⁵³ + 1) cannot be stored exactly — you get 9007199254740992 back. For converting a 64-bit hex value like `0xdeadbeefcafef00d` to decimal, that precision loss produces wrong answers. BigInt gives arbitrary-precision integers, so any value you can type fits exactly.
What is the maximum base I can use?
36, because that uses every digit and every letter exactly once (0–9 + a–z = 36 symbols). Higher bases exist in specific contexts: Base58 (Bitcoin), Base64 (binary-to-text encoding), Base85 (PDF and Adobe formats). Those use larger or curated alphabets and are not interchangeable — each is a separate encoding format rather than a generic base. If you need Base64, use the Base64 Encode/Decode tool linked below.
Why do negative hex numbers show as `-ff` instead of two's complement?
Two's complement is a specific binary representation used by CPUs to store signed integers in fixed-width registers: -1 in 8-bit two's complement is `11111111` (255 unsigned). Without knowing the width, there is no canonical two's complement form for "negative ff." This tool treats the input as a mathematical integer with a sign, so `-ff` is simply "negative 255." If you need a specific bit-width two's complement representation, take `2ⁿ - value` for n-bit width.
Is anything sent to a server?
No. Parsing and conversion happen in your browser using BigInt arithmetic. The tool makes zero network requests at runtime.