Developer Tools
Number Base Converter (Binary, Hex, Octal)
Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36 — including very large integers.
How to use
- 1Enter a number and the base it's written in.
- 2See it in binary, octal, decimal, hex and your custom base.
How it's calculated
Uses arbitrary-precision integers (BigInt), so numbers of any length convert exactly.
Frequently asked questions
How do I convert binary to decimal?
Each binary digit is a power of two: 1011 = 1×8 + 0×4 + 1×2 + 1×1 = 11.
Can I include prefixes like 0x or 0b?
Yes. 0x, 0b and 0o prefixes are removed automatically, as are spaces and underscores used as separators.
Are negative numbers and fractions supported?
Negative whole numbers are supported with a leading minus sign. Fractions aren't converted — enter whole numbers.
Why BigInt, not Number
JavaScript's regular Number type is a 64-bit float that can only represent integers exactly up to 2^53 (about 9 quadrillion) — past that, conversions silently lose precision. This converter builds the result digit-by-digit using BigInt arithmetic (`x = x * BigInt(base) + BigInt(digit)`), so a 30-digit decimal number converts to hex exactly, which matters if you're working with 64-bit or 128-bit values, cryptographic constants, or database snowflake IDs where even one lost bit gives you a wrong answer that looks plausible.
What input formats it tolerates
The parser lowercases the input, strips spaces and underscores used as digit separators (so `1_000_000` works), and — critically — only strips a `0x`/`0b`/`0o` prefix when it doesn't match the base you declared, so pasting a literal straight from source code (`0xFF`, base 16) works without manually trimming the prefix first, but typing `0x` while the base is already set to 16 won't double-strip it. Any character outside the valid digit set for the chosen base throws immediately with the exact allowed digit list, rather than silently truncating or substituting zero.
What it deliberately doesn't do
Negative integers work via a leading minus sign carried through the conversion, but fractional values aren't supported in any base — there's no radix-point handling, so `3.14` isn't a valid input regardless of base. If you need fractional base conversion, you're looking at a different kind of tool entirely (arbitrary-precision decimal arithmetic), since the digit-by-digit BigInt algorithm here is integer-only by construction.
Worked example: Number Base Converter
Enter 255 as a base-10 number: binary comes out as 11111111, octal as 377, hex as FF, and base 36 (the default 'also show' base) as 73 — a quick sanity check being 255 = 1111 1111₂ = 0xFF, the maximum value of a single unsigned byte. Flip the input to `0xFF` with the 'written in base' set to 16, and decimal comes back as 255 again, confirming the prefix-stripping and round trip both work as expected.
A 0x prefix is stripped only when the base is hexadecimal
The number opens on 255 and the base opens on decimal. Spaces and underscores are ignored, and letters are read in lowercase. A leading minus stays negative. A 0x prefix is removed only when the base is hexadecimal. On any other base those characters stay, and the value is rejected because x is not a digit there. The same rule applies to 0b on binary and 0o on octal. The extra base opens at 36 and only accepts 2 through 36, and it is rounded to a whole number. Hexadecimal in the results is shown in capitals.
Related tools
- Text to Binary, Hex, Octal & Decimal
Convert text to binary, hexadecimal, octal or decimal byte codes (UTF-8), and convert those codes back to text.
- ASCII Table
Full ASCII table with decimal, hex, octal and binary codes for all 128 characters, control code names and HTML entities.
- Chmod Calculator
Convert Linux file permissions between numeric (755) and symbolic (rwxr-xr-x) notation, with a plain-English breakdown and the chmod command.
- Color Picker & Converter (HEX, RGB, HSL, CMYK)
Pick a color or paste any code and convert between HEX, RGB, HSL, HSV and CMYK — with tints, shades and ready-to-copy CSS values.
- AI API Cost Calculator (LLM Token Pricing)
Estimate what an LLM-powered feature will cost — tokens per request, requests per month, input/output prices per million tokens, prompt caching and batch discounts. Works for any model: enter your provider's current prices.
- Binary & Hex Arithmetic Calculator
Add, subtract, multiply and divide numbers in binary, octal or hexadecimal, and do bitwise AND, OR, XOR and shifts — exact for large numbers.