Skip to main content

Number Base Converter: Binary, Octal, Decimal, Hex

Convert a number between binary, octal, decimal, hexadecimal, and any base from 2 to 36. Built on BigInt for exact results past 2⁵³ − 1, with two's complement at 8/16/32/64-bit widths and ASCII detection. Free and 100% in your browser.

Enter a Value

base 10
Bit Width

Arbitrary Precision (BigInt)

Convert values far beyond JavaScript's 2⁵³ safe integer limit — UUIDs, hash digests, cryptographic constants — without precision loss. We use the native BigInt arithmetic underneath.

Bases 2 Through 36

Standard binary, octal, decimal, hex — plus any base from 2 to 36 (digits 0-9 then a-z). Recognises and strips `0b`, `0o`, `0x`, and `#` radix prefixes automatically.

Two's Complement Mode

Display signed values at fixed 8-, 16-, 32-, or 64-bit widths using two's complement. Surfaces ASCII character mapping when the byte-range value matches printable ASCII.

100% Client-Side

Every conversion runs in your browser via BigInt math. Memory addresses, license keys, internal product IDs — none of it leaves your device, ever.

Number Base Converter: Binary, Octal, Decimal, Hex, and Bases 2–36

A number base converter rewrites the same integer in a different positional system — base 2 (binary), base 8 (octal), base 10 (decimal), base 16 (hexadecimal), or any radix from 2 to 36. Type a value in one base and every other base appears at once, computed with BigInt so results stay exact past 2⁵³ − 1. It runs 100% in your browser, free, with no upload.

How to convert a number between bases

  1. Click the base tab for your input: BIN (2), OCT (8), DEC (10), or HEX (16).
  2. Type or paste the value. Prefixes (0b, 0o, 0x, #), spaces, and underscores are stripped automatically.
  3. Read the result — all four common bases update instantly, with binary grouped in 4-bit nibbles for readability.
  4. Drag the custom base slider (2–36) to render the value in any other radix, such as base 36 for short tokens.
  5. Set Bit Width to 8, 16, 32, or 64 to see the two's complement signed binary, hex, and decimal forms.
  6. Click the copy icon on any row to send that representation to your clipboard.

What is a number base, and how does conversion work?

A number base (or radix) is the count of unique digits in a positional numeral system. In positional notation, each digit's value is multiplied by the base raised to its position. So 0x1A is 1×16¹ + 10×16⁰ = 26, and 0b1010 is 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 10. To convert, you collapse the input to a single integer, then repeatedly divide by the target base, reading remainders bottom-up.

The prefixes this tool reads are the same ones the language grammar defines: 0b/0B for binary, 0o/0O for octal, and 0x/0X for hexadecimal. Per MDN's JavaScript lexical grammar, underscores (_) are valid digit separators (0b1010_0001) and a trailing n marks a BigInt literal — the exact type this converter uses internally so no value is truncated.

"Binary number syntax uses a leading zero followed by a lowercase or uppercase Latin letter B (0b or 0B)... Octal uses 0o, hexadecimal uses 0x."— MDN Web Docs, Lexical grammar

A historical gotcha: a bare leading zero (0755) means octal in C and older JavaScript, but the modern 0o prefix was added to remove that ambiguity. The binary 0b prefix only became a standard C feature in C23; before that it was a GCC extension. This tool ignores a bare leading zero and treats input by the base tab you pick.

Worked examples: input → output

Hex → decimal · HEX tab

0xCAFE → 51966 (dec) · 1100 1010 1111 1110 (bin) · 145376 (oct)

Binary → decimal · BIN tab

10101010 → 170 (dec) · AA (hex) · 252 (oct)

ASCII detection · DEC tab

65 → 0x41 · 0b0100 0001 · ASCII char ‘A’ (range 32–126)

Edge case · signed overflow

Enter 200 in decimal and set Bit Width to 8. An 8-bit signed integer only spans −128 to 127, so 200 overflows that range — the tool shows an overflow warning. The two's complement bits (1100 1000) still display, because that byte pattern is the unsigned 200 but reads as the signed value −56. Same bits, two meanings: that is the whole point of fixing a bit width.

Base reference: digits, prefixes, and where each matters

BaseNameDigitsPrefixWhere it matters
2Binary0–10bBitmasks, CPU flags, permission bits
8Octal0–70oUNIX file permissions (chmod 755)
10Decimal0–9Human reading, counters, financial values
16Hexadecimal0–9, a–f0x / #Color codes, memory addresses, hash digests
36Base 360–9, a–zShort tokens, URL shorteners, compact IDs

Two's complement reference (8-bit)

Most CPUs store signed integers in two's complement: the top bit carries weight −2^(N−1), so an N-bit signed value spans −2^(N−1) to 2^(N−1) − 1. To negate, flip every bit and add 1. Unlike sign-magnitude, there is only one representation of zero.

ValueBinary (8-bit)Hex (8-bit)
50000 01010x05
−11111 11110xFF
−51111 10110xFB
−128 (min)1000 00000x80
127 (max)0111 11110x7F

The 2⁵³ limit most converters silently hit

A standard JavaScript number is a 64-bit IEEE 754 double, so it is exact only up to Number.MAX_SAFE_INTEGER = 2⁵³ − 1 (9,007,199,254,740,991). The instant a converter built on parseInt sees a bigger value — a SHA-256 digest, a 64-bit pointer, a UUID — it rounds to the nearest representable double and gives you the wrong binary or hex back, with no error. This tool parses with BigInt end to end, so a 512-bit ECDSA key converts digit-for-digit exactly. That is the difference no marketing copy mentions.

One more detail mined from the parser: it accepts #FF as hex (the CSS color form) in addition to 0xFF, and strips spaces and underscores from any input — so 1010 1010, 1010_1010, and 0b10101010 all parse to the same 170.

Runs 100% in your browser

Your numbers never leave your device. Parsing, base math, two's complement, and formatting all happen locally with native BigInt arithmetic — no uploads, nothing leaves your device. I tested conversions across every common base, the full custom 2–36 range, negative inputs at 8/16/32/64-bit widths, the 0x/0b/0o/# prefixes, and values well past 2⁵³ — including a full SHA-256 hex digest — and the output stayed exact and instant. Memory addresses, license keys, and internal product IDs are safe to paste here.

Frequently asked questions

Is this number base converter free?

Yes — 100% free with no signup and no usage limit. Convert as many values between binary, octal, decimal, hex, and any base from 2 to 36 as you want.

Does my number get uploaded anywhere?

No. Every step runs in your browser with native BigInt math, so nothing is sent to a server and the tool works offline once the page loads.

How do I convert binary to decimal or hex to decimal?

Pick the BIN or HEX tab, paste your value, and the decimal form (plus every other base) appears instantly — no convert button needed.

Why does this use BigInt instead of regular numbers?

A JavaScript number is exact only to 2⁵³ − 1. Past that, large hex digests and 64-bit addresses lose precision. BigInt converts any-sized integer with no rounding.

Last updated: June 2, 2026 · Runs 100% in your browser — no uploads, nothing leaves your device.

Need a different tool?

Browse all 89 free, in-browser tools — or tell us what we should build next.

Browse all tools