Number Base Converter
Convert a number between binary, octal, decimal, hexadecimal and any base from 2 to 36 — live, and BigInt-safe so even huge integers convert with no precision loss.
Runs entirely in your browser. Every conversion uses native BigInt arithmetic on your device — no digit is ever rounded, and no number you type is uploaded or logged.
Fixed-width bits, two’s-complement & bitwise
Pick a machine word size and see exactly how the value above lands in a real register — its two’s-complement bit pattern, its signed vs unsigned reading, and a live bitwise calculator. All math is BigInt masked to the width, so 64-bit is exact.
Values that fit this width/sign: —
What a number base actually is
A base (or radix) is simply how many distinct digit symbols a place-value system uses, and therefore what each position is worth. In base 10 the number 255 means 2×10² + 5×10¹ + 5×10⁰. The same quantity written in base 16 is FF — 15×16 + 15 — and in base 2 it is 1111 1111. Nothing about the amount changes; only the alphabet and the size of each place do. A single number, four faces:
The 0x, 0b and 0o prefixes are how most programming languages mark a literal's base in source code — this converter shows the bare digits, so you add whichever prefix your language expects. Type a value on the left, pick the base to read it in, and every other base is rewritten on the right as you type. New to this? The guide Number Bases Explained builds positional notation, binary, hex and two's-complement up from first principles with a fully worked example.
The two conversion algorithms
Every base conversion is really two moves: parse the input into a single quantity, then format that quantity in the target base. Parsing (any base → value) is a left-to-right multiply-and-add: start at 0, and for each digit do value = value × base + digit. Formatting (value → any base) is the mirror image — repeatedly divide by the base and read the remainders from last to first. Here is decimal 13 becoming binary, step by step:
Hexadecimal uses exactly the same loop with a divisor of 16 and remainders 0–15 written 0–9 then A–F: 255 ÷ 16 = 15 r 15, and 15 is F, so 255 becomes FF. Going the other way, 1A hex = 1×16 + 10 = 26. Because hex maps exactly four bits to one digit and octal maps exactly three, converting between binary, octal and hex needs no arithmetic at all — you just regroup the bits: 1111 1111 → nibbles F F, or triplets 011 111 111 → 3 7 7.
Reference table: the same values in four bases
Keep this handy for reading byte dumps and bitmasks. Notice the round numbers: powers of two are a single 1-bit in binary, and FF, FFFF, FFFFFFFF are the largest values that fit in 1, 2 and 4 bytes.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 64 | 1000000 | 100 | 40 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
| 65535 | 1111111111111111 | 177777 | FFFF |
Where each base earns its keep
Hex (base 16) is the default shorthand for raw bytes because two hex digits are exactly one byte. You meet it in CSS colors (#5B6CFF is R=91, G=108, B=255), memory addresses in a debugger, MAC addresses, UUIDs, and hex dumps of binary files. Octal (base 8) survives mainly in Unix file permissions: chmod 755 reads as three octal digits, one per rwx group, where 7 = 111 = read+write+execute and 5 = 101 = read+execute. Binary (base 2) is where bitmasks and flags live — testing flags & 0b0100 checks a single bit, and a permissions or feature-toggle integer is just a row of on/off bits. Decimal is for humans; almost everything else is for machines that ultimately store bits.
Signed numbers and two's-complement
This tool shows negatives in signed-magnitude form — a leading minus, so −255 reads as −FF. That is the honest, width-independent view. Hardware and most languages instead use two's-complement at a fixed width, where the top bit carries a negative weight. To find −6 in an 8-bit two's-complement byte: write +6, flip every bit, then add 1.
The same bit pattern 1111 1010 is 250 if the byte is unsigned and −6 if it is signed — the bits alone never tell you which. That ambiguity is exactly why two's-complement means nothing until you fix a width and a signedness. The fixed-width panel above does exactly that: choose 8/16/32/64-bit and signed or unsigned, and it prints the value's two's-complement pattern together with both readings, so you can watch −1 become 0xFF at 8-bit and 0xFFFFFFFF at 32-bit. A value too big for the width is flagged rather than quietly truncated. The bitwise calculator beside it runs AND / OR / XOR / NOT and left/right shifts at that same width using exact BigInt math, so even 64-bit operations are correct to the last bit.
Why BigInt matters here
Plain JavaScript numbers are 64-bit floating point, which represent integers exactly only up to 2⁵³ − 1 (9 007 199 254 740 991). Beyond that, the familiar parseInt/toString route silently corrupts the low digits — parseInt("9007199254740993") already comes back as 9007199254740992. This converter instead parses and formats with native BigInt, which holds integers of unbounded size precisely. That is what lets a 256-bit hex hash, a 50-digit decimal, or a very long binary string round-trip digit-for-digit with no loss. The stat tiles report the bit length (bits in the magnitude), the byte count (bits rounded up to whole bytes), and the number of decimal digits, so you can size a field or a buffer at a glance. Digit grouping is cosmetic — binary and hex group in fours, decimal and octal in threes — so toggle it off to paste an unbroken string into code.
Common mistakes
Reading a leading zero as octal. In C, Go, and older JavaScript, 0377 is octal 255, not decimal 377 — a stray leading zero silently changes the value. Modern languages prefer the explicit 0o prefix to kill that ambiguity. Mixing signed-magnitude and two's-complement. Expecting −1 to look like FF (byte), FFFF (word) or a leading minus depends entirely on width and signedness; decide those first. Uppercase vs lowercase hex. FF and ff are the same value, but a case-sensitive string compare or a checksum over the text will call them different — normalise before comparing. Off-by-one on bit width. An 8-bit field holds 0–255, not 0–256; the count of values is 2⁸ but the maximum is 2⁸ − 1. Assuming float precision. Converting a number bigger than 2⁵³ with parseInt/Number quietly drops low digits — use BigInt (as this tool does) for anything hash- or ID-sized.
Honest limits
This is an integer converter: it does not handle fractional parts or a binary point, so 3.5 is rejected rather than half-converted. The main multi-base view uses signed-magnitude (a leading minus); fixed-width two's-complement lives in its own panel above, where a width and signedness are chosen explicitly. And the maximum base is 36, the widest radix that fits in the 0–9 A–Z alphabet with one unambiguous, case-insensitive symbol per digit — base 62 and Base64 exist but reuse letter case (or +/) as distinct symbols, which this case-insensitive tool does not.