Number Base Converter
Convert between binary, octal, decimal, and hexadecimal. Supports BigInt and bitwise operations with signed widths.
Bitwise operations
About this tool
Number Base Converter cross-translates an integer between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Type the value in any of the four input fields and the other three update in lockstep. Arbitrary-precision math is built in — paste a 1024-bit hash and you still get an exact answer, no floating-point rounding.
A second panel runs bitwise operations on the same value: AND, OR, XOR, NOT, left shift, right shift, arithmetic right shift. For each operation you pick the integer width (8/16/32/64 bits, signed or unsigned) so two's-complement representations are shown correctly — 0xFF is 255 in u8 but -1 in i8, and the tool labels both. A live binary preview highlights individual bit positions so you can see exactly what flipped.
When to use this tool
- Reading and writing config flags. Many APIs use bitmask flags; converting
0b10110to22or back is an everyday tax on this style. - Debugging hex dumps. A byte showing
0xC0in memory? That is192decimal,0b11000000binary. - Computing colour values. CSS hex colours, ANSI escape codes, and image-format byte streams all live in hex.
- Working with file permissions.
0o755↔0b111101101— the conversion is the foundation of the Chmod Calculator.
About BigInt and signed widths
JavaScript's nativeNumber loses precision past 2^53. We use BigInt for the value itself, so any integer you can write fits. Signed widths matter for negative numbers: two's complement at 8 bits says 0b10000000 = -128; at 16 bits the same pattern is 32768. The tool always shows you both interpretations so the right one is just a glance away.
Frequently asked questions
Why does 0xFF show as both 255 and -1?
How big a number can the tool handle?
What is the prefix convention?
0b for binary (Python, JS, Rust), 0o for octal (Python, JS, Rust — the older bare-leading-zero form is deprecated), 0x for hex (universal). Our tool accepts inputs with or without prefixes and always emits results in the conventional prefixed form. C/C++ uses bare-leading-zero for octal (0755), which is a footgun — we never output that form.
Why does shift-right behave differently sometimes?
>>>) fills the high bits with 0 — used for unsigned values. Arithmetic (>>) fills with the sign bit — preserves the sign of negative numbers in two's complement. -8 >> 1 = -4 (arithmetic) but -8 >>> 1 = 2147483644 (logical, 32-bit). The tool exposes both as separate buttons.