Number Base Converter
Convert between binary, octal, decimal, hex and any base 2–36 — exact at any size, entirely on this device.
Pads the single-result binary and hex displays with leading zeros to whole bytes — copies, batch cells and the CSV stay canonical.
| Binary | — | |
|---|---|---|
| Octal | — | |
| Decimal | — | |
| Hex | — | |
| Base | — | |
| Two's complement (off) | — |
Press ? for shortcuts
Do it offline:$ echo 'ibase=16; DEADBEEF' | bc
How to use it
- Enter a value. A 0x, 0b or 0o prefix picks the source base and the badge names it; bare digits follow the selector (decimal to start).
- Read the rows: binary, octal, decimal, hex and a base-N of your choice update together, each with a copy button that takes the ungrouped form.
- For a bit pattern, pick a signed width — 8, 16, 32 or 64. The two's-complement row fills in; a value that does not fit offers to widen.
- For a list, switch to Batch: one value per line, prefixes mixed. Failed lines never stop the rest, and the table downloads as CSV.
Type a number in any base from 2 to 36 and read it in all of them at once — binary, octal, decimal, hex, a base of your choice and an optional two's-complement pattern. A 0x, 0b or 0o prefix picks the source base for you. Arithmetic is big-integer end to end, a list converts in one paste, and nothing leaves this device.
How it works
Parsing is one loop: each digit multiplies the running total by the base and adds itself, accumulating into a BigInt, never a float. Output rows are the mirror image — BigInt's own toString at radix 2, 8, 10, 16 or the base-N you picked. One exact value in the middle keeps every row agreeing.
The float shortcut is what breaks other tools: a JavaScript Number is an IEEE-754 double with a 53-bit mantissa, so above 9007199254740991 it cannot tell neighboring integers apart. BigInt has no ceiling. Signed mode adds one mask — after a range check, the value ANDed with 2^width − 1 is the width-padded two's-complement pattern.
Examples
0xFFbinary 0b11111111
octal 0o377
decimal 255
hex 0xFF
base-36 73The 0x prefix outranks the selector, so the badge reads hexadecimal (0x). Five faces of one 255, each copy-ready in canonical form.
10000x3E8Bare digits follow the selector — decimal here. 1000 lands as 0x3E8 in hex, 0b1111101000 in binary, 0o1750 in octal.
184467440737095516160x100000000000000002^64, one past the top of an unsigned 64-bit range — and still exact. The chip beside the row says it plainly — exact: this tool never rounds large integers.
-10b11111111At an 8-bit signed width, -1 masks to all ones: 0b11111111, or 0xFF — the two's-complement identity.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
Above 9007199254740991, floats drift
Read 18446744073709551615 through a float and 18446744073709551616 comes back — off by one. Big integers carry the value here, so all sixteen F digits of 0xFFFFFFFFFFFFFFFF survive.
Long values leave the main thread
From 4,096 digits, conversion runs in a worker so typing never stalls; the ceiling is 100,000 digits per value, and past it the page refuses outright.
Underscores and spaces are separators
Paste 0xDEAD_BEEF and the underscore is stripped before parsing, with a counting chip — 1 separator stripped — so you get 3735928559, not an error.
A minus sign is not a bit pattern
Unsigned mode keeps the sign on every row — -42 renders as -0x2A — plus a chip pointing at signed mode. 0xFF at 8-bit signed refuses — 255 exceeds 127; nothing flips negative in silence.
Base 36 uses the whole alphabet
Ten digits plus twenty-six letters: z is worth 35, and input case never matters. Base 2 rejects every digit beyond 0 and 1.
Batch lines detect independently
0xFF, 0b1010, 0o755 and 99 on one list convert to 255, 10, 493 and 99. A failing line carries its own error and line number; neighbors convert regardless.
Padding is display-only
Pad to full bytes byte-aligns the binary and hex displays: 0xABC reads 0x0ABC, 42's binary becomes 00101010. Copies stay canonical — 0xABC and 0b101010 — leading zeros are presentation, never value.
Common errors
`G` is not a valid hexadecimal digit (0-9, A-F)- The parser names the base in words, prints the digit set it accepts, and highlights the character it stopped on; the input stays untouched. A stray letter usually means the wrong base.
Integers only for now — fractional base conversion is planned- The anchored dot is the tell: this tool converts integers, and a fractional part needs per-base expansion rules of its own, so the page refuses instead of rounding the fraction away.
`40000` does not fit in 16 bits signed (-32,768 to 32,767) — widen to 32-bit?- A 16-bit signed slot holds -32,768 through 32,767; 40000 is past the top. Widen re-runs at the next width; at 64-bit the question disappears — no next width exists.
Input is larger than the 1 MB limit for this tool. For bigger payloads use the CLI: echo 'ibase=16; DEADBEEF' | bc- Past 1 MB the page refuses the whole input rather than converting a plausible prefix of it. The banner's bc line runs the same arbitrary-precision conversion on your machine.
FAQ
How do I convert hex to decimal?
Type the value with its 0x prefix — 0xFF — or paste bare digits like DEADBEEF and pick hexadecimal on the selector. The decimal row is the answer: 255 for the first, 3735928559 for the second; binary, octal and base-N fill in from the same paste.
Why do other converters round large numbers?
Most run on JavaScript's Number, a float that holds integers exactly only up to 9007199254740991; past that, input snaps to the nearest double, subtly wrong. Every step here is BigInt, which is how 2^64 prints as 18446744073709551616, not an approximation.
What is two's complement?
How computers store signed integers: a w-bit slot keeps the bits of value + 2^w for negatives — the same result as masking with 2^w − 1. At 8 bits, -1 is 11111111, or 0xFF, and the range is -128 to 127. Pick a width above to see that exact pattern.
Keyboard shortcuts
- ⌘/Ctrl + Enter
- Run the current input again.
- ⌘/Ctrl + S
- Download the result: .txt single value, .csv batch.
- ⌘/Ctrl + C
- Copy the whole results panel while nothing is selected.
- ⌘/Ctrl + Shift + C
- Copy the results panel even over a selection.
- t
- Cycle the theme (ignored while typing).
- ? or ⌘/Ctrl + /
- Open this page's keyboard reference.
- Esc
- Dismiss the top overlay; input stays put.