Number Base Converter
Convert numbers between any base from 2 to 36 with arbitrary precision, fractions, and two's complement analysis.
Updated
What is the Number Base Converter?
The Number Base Converter turns any number into any radix from base 2 up to base 36 — instantly, accurately, and without the overflow bugs that plague most online converters.
Unlike calculators that silently cap at 32 or 53 bits, this tool uses arbitrary-precision BigInt arithmetic, so a 512-bit hex hash converts to decimal without losing a single digit. It also handles fractional numbers, negative values, digit separators, and base prefixes (0x, 0b, 0o, #) automatically.
Why use this converter
- Every base from 2 to 36 — binary, ternary, octal, decimal, duodecimal, hex, base32, base36, and everything in between.
- Arbitrary precision — convert numbers of any size using BigInt; no silent overflow at 2³² or 2⁵³.
- Fractional support — convert values like
3.14or0x1.8with configurable precision up to 128 digits. - All-bases view — see the same number rendered in every common base at once.
- Programmer analysis — bit length, byte length, two's-complement hex for 8/16/32/64-bit widths, and fits-in-type badges for
i8…u64. - Smart input — auto-detects
0x,0b,0o, and#prefixes; ignores spaces, underscores, commas, and apostrophes. - One-click copy & swap — round-trip conversions in a single click.
Whether you're debugging a memory dump, learning how binary works, or writing a low-level protocol, this converter gives you the answer and the context in one screen.
How it works
1. Parse the input
The input string is trimmed, sign-detected, and stripped of common separators (_, ,, spaces, apostrophes). Base prefixes are auto-detected:
| Prefix | Detected base |
|---|---|
0x, # |
16 (hexadecimal) |
0b |
2 (binary) |
0o |
8 (octal) |
Each remaining character is validated against the source base. Digits 0–9 map to their value; letters A–Z map to 10–35 (case-insensitive).
2. Convert to an exact intermediate value
- The integer part is accumulated into a
BigIntusing Horner's method:n = n × base + digit
This preserves every bit — no precision loss regardless of length. - The fractional part is accumulated as a JavaScript number:
f = Σ digitᵢ × base⁻ⁱ
3. Emit into the target base
- Integer output uses repeated
BigIntdivision by the target base, collecting remainders as digits. - Fractional output uses repeated multiplication by the target base, taking the integer part of each step as the next digit. Output stops at the configured fraction precision (default 20, max 128). Trailing zeros are trimmed, and the result is flagged approximate if the fraction did not terminate.
4. Format for readability
- Digits are cased per the Uppercase toggle.
- Digits are grouped: nibbles of 4 for base 2 and base 16, groups of 3 for every other base.
- A base prefix (
0b,0o,0x) is added when Show base prefix is enabled.
5. Programmer analysis (integers only)
For integer inputs, the tool also computes:
- Bit length and byte length of the magnitude.
- Two's-complement hex for 8-, 16-, 32-, and 64-bit widths (shown only when the value fits).
- Fits-in badges for
i8,i16,i32,i64,u8,u16,u32,u64— instantly tells you which C-style integer types can hold the value.
6. All-bases panel
Every common base (2, 3, 4, 5, 6, 8, 10, 12, 16, 32, 36) is rendered from the same parsed value, so you can compare representations side-by-side and copy any of them with a single click.
Examples
Decimal to hexadecimal
Convert a decimal integer to its hexadecimal representation with the 0x prefix.
Binary to decimal
Convert a grouped binary literal to decimal. Separators and the 0b prefix are auto-detected.
Hex fraction to decimal
Convert a fractional hex value to base 10 using the configured fraction precision.
Negative decimal to two's complement
View the 8-bit two's complement hexadecimal representation of a negative integer.
Decimal to base 36
Compress a large integer using alphanumeric base 36 digits (0–9, A–Z).
Frequently asked questions
What bases does this converter support?
What bases does this converter support?
Any integer base from 2 to 36. Digits use 0–9 followed by A–Z, giving 36 unique symbols — the standard alphanumeric radix range. Common bases (binary, octal, decimal, hex, base32, base36) are pre-labelled in the dropdown, and the all-bases panel shows the most useful ones side-by-side.
Can I convert very large numbers without losing precision?
Can I convert very large numbers without losing precision?
Yes. The converter uses JavaScript's BigInt for the integer part, so numbers of any size — 256-bit hashes, 1024-bit RSA keys, cryptographic nonces — convert exactly. Most online converters silently overflow past 2³² or 2⁵³; this one does not.
Does it support fractional (floating-point) numbers?
Does it support fractional (floating-point) numbers?
Yes. Enter values like 3.14, 0.1, or 0x1.8 and the converter handles the fractional part separately. You can set fraction precision from 0 to 128 digits. If the fraction doesn't terminate in the target base (for example, 0.1 in binary), the result is flagged as approximate.
How do I input hex, binary, or octal directly?
How do I input hex, binary, or octal directly?
Just type the prefix — the converter auto-detects it and switches the source base:
0xor#→ hexadecimal0b→ binary0o→ octal For example, typing0xFFautomatically sets From base to 16.
Can I use separators like spaces or underscores?
Can I use separators like spaces or underscores?
Yes. Spaces, underscores (_), commas (,), and apostrophes (') are ignored, so 1_000_000, 1,000,000, and 1 000 000 all parse as one million. This makes long binary and hex literals easy to read and paste.
How are negative numbers handled?
How are negative numbers handled?
Prefix the value with - and the converter preserves the sign across bases. For low-level work, the Integer analysis panel additionally shows the two's-complement hex representation at 8, 16, 32, and 64 bits — exactly what a CPU would store in memory.
What is two's complement and why do I care?
What is two's complement and why do I care?
Two's complement is how virtually every modern CPU represents signed integers. To negate a value, you invert all bits and add 1. The tool shows the resulting hex bytes for common register widths, which is invaluable when reading memory dumps, debugging embedded firmware, or reversing binary protocols.
What do the fits-in badges (i8, u16, i32…) mean?
What do the fits-in badges (i8, u16, i32…) mean?
They tell you whether the value fits into a standard C-style integer type — signed (i8…i64) or unsigned (u8…u64). Badges that are struck through mean the value overflows that type. This is a quick sanity check when picking a struct field or database column width.
Why does my binary fraction end with an ≈ sign?
Why does my binary fraction end with an ≈ sign?
The ≈ (approximate) flag means the fractional part didn't terminate within the configured precision. Many decimals — like 0.1 — are infinite repeating fractions in binary, just as 1/3 is 0.333… in decimal. Increase Fraction precision to see more digits.
Is my data sent to a server?
Is my data sent to a server?
No. All parsing and conversion runs entirely in your browser using pure JavaScript. Nothing is uploaded, logged, or stored — safe for sensitive keys, hashes, and identifiers.
Related tools
More utilities you might find handy.
Base64 Encoder / Decoder for Text, Images & Docs
Instantly convert plain text, images, PDFs, and documents to Base64 strings or decode Base64 data arrays back into downloadable file assets.
Binary to Hex
Convert binary numbers to hexadecimal quickly with support for padding, two's complement, bit-widths, grouping and BigInt-sized inputs
Camel, Snake, Kebab Case Converter
Effortlessly convert text between camelCase, snake_case, kebab-case, PascalCase, and more for developers and writers.