Number Base Converter
Type a value in binary, octal, decimal or hex — the other bases update live. Optional 0b / 0o / 0x prefixes; BigInt-ready for large integers.
How do I convert between binary, decimal and hex?
What this tool does
Type a value in binary, octal, decimal or hexadecimal and the other three fields update instantly. Optional prefixes (0b, 0o, 0x) are stripped automatically, and BigInt arithmetic handles integers far larger than normal JavaScript numbers allow. Copy decimal with one click when you need a plain integer for docs or code.
Why you need it
Low-level debugging still speaks in bases other than ten. Memory addresses, permission bitmasks, network masks, firmware registers and protocol dumps arrive as hex or binary strings. Color channels and file headers hide numeric values in base 16. Without a fast converter you risk transposing digits, misreading FF as 255 vs 65535 context, or losing precision on 64-bit flags in languages that truncate large integers.
How to use it
- Click any of the four fields and enter digits for that base.
- Watch binary, octal, decimal and hex stay synchronized as you type.
- Paste values with or without
0b/0o/0xprefixes. - Use Load sample to explore a worked example.
- Copy decimal for the canonical integer representation.
Practical examples
- Bitmask flags: Convert
0b1010to decimal 10 to see which permission bits are set. - Memory dumps: Turn a hex offset like
0x1A3Finto decimal for spreadsheet math or array indexing. - Network math: Express a subnet mask fragment in binary to verify contiguous ones.
- Teaching & interviews: Show how decimal 255 becomes
FFin hex and11111111in binary.
How it works
Every base is just a different way to write the same integer. Binary (base 2) uses digits 0 and 1 — each position is a power of two. Octal (base 8) groups bits in threes and appears in Unix file permissions. Decimal (base 10) is everyday math. Hexadecimal (base 16) compresses four bits per digit using 0–9 and A–F, which is why dumps and CSS color channels favor it.
When you edit one field, the tool parses valid digits for that radix, converts to a BigInt internally, then renders the equivalent string in each other base. Invalid characters surface as a clear error instead of a silent wrong answer. Because BigInt is used end-to-end, values beyond Number.MAX_SAFE_INTEGER (9,007,199,254,740,991) remain exact — important for 64-bit identifiers and large counters.
Common mistakes
- Invalid hex letters: Only 0–9 and A–F are legal in base 16;
Gor8in octal breaks parsing. - Leading zeros changing meaning: In some languages
012is octal; here prefixes disambiguate — use0o12when you mean octal. - Confusing width with value:
000FFandFFare the same number; bit width matters for fixed-size registers, not for numeric equality. - Float vs integer: This tool handles whole integers only — fractional values belong in a calculator, not a base converter.
FAQ
Which bases are supported?
Binary (2), octal (8), decimal (10) and hexadecimal (16). Edit any field and the others update live.
Are prefixes like 0x required?
No. Paste digits only, or include 0b / 0o / 0x — both work.
How large can numbers be?
Values use JavaScript BigInt, so very large integers are supported beyond Number.MAX_SAFE_INTEGER.
Why does hex use letters A–F?
Base 16 needs sixteen symbols. Digits 0–9 cover the first ten; A–F represent ten through fifteen. Case usually does not matter.
Can I paste negative numbers?
Yes. A leading minus sign is preserved and converted consistently across all bases.
Is input uploaded anywhere?
No. Conversion runs locally in your browser.