Number Base Converter: Binary, Decimal and Hex
Convert integers between binary, octal, decimal, hexadecimal, and other supported bases. Check the input base before comparing the output.
Number Base Converter workspace
Enter a Value
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
Convert integers between binary, octal, decimal, hexadecimal, and other supported bases. Check the input base before comparing the output. The same digits can represent different values in different bases. Use an explicit base when sharing a result, especially for hexadecimal or binary notation. Signed representations also require an agreed bit width; a negative integer and a two's-complement bit pattern are different descriptions.
How to use the number base converter
- Click the base tab for your input: BIN (2), OCT (8), DEC (10), or HEX (16).
- Type or paste the value. Prefixes (
0b,0o,0x,#), spaces, and underscores are stripped automatically. - Read the result — all four common bases update instantly, with binary grouped in 4-bit nibbles for readability.
- Drag the custom base slider (2–36) to render the value in any other radix, such as base 36 for short tokens.
- Set Bit Width to 8, 16, 32, or 64 to see the two's complement signed binary, hex, and decimal forms.
- 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
| Base | Name | Digits | Prefix | Where it matters |
|---|---|---|---|---|
| 2 | Binary | 0–1 | 0b | Bitmasks, CPU flags, permission bits |
| 8 | Octal | 0–7 | 0o | UNIX file permissions (chmod 755) |
| 10 | Decimal | 0–9 | — | Human reading, counters, financial values |
| 16 | Hexadecimal | 0–9, a–f | 0x / # | Color codes, memory addresses, hash digests |
| 36 | Base 36 | 0–9, a–z | — | Short 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.
| Value | Binary (8-bit) | Hex (8-bit) |
|---|---|---|
| 5 | 0000 0101 | 0x05 |
| −1 | 1111 1111 | 0xFF |
| −5 | 1111 1011 | 0xFB |
| −128 (min) | 1000 0000 | 0x80 |
| 127 (max) | 0111 1111 | 0x7F |
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.
Related developer & encoding tools
Inspect large hex SHA digests as decimal or binary
HMAC GeneratorKeyed hex digests you can convert here
UUID Generator128-bit values rendered as 32 hex digits
Color ConverterTurn #FF hex color values into RGB/HSL
Base64 EncoderA different encoding when bases are not enough
Random Number GeneratorGenerate values to test conversions
Password GeneratorCreate strong random secrets in your browser
QR Code GeneratorEncode data into a scannable code
HTTP Status CodesReference table of every response code
Cron Expression BuilderBuild and decode cron schedules
All ToolsBrowse the full Toolk utility hub
Last updated: September 15, 2026 · Runs 100% in your browser — no uploads, tool input is not sent to Toolk.
Frequently asked questions
Why does this converter use BigInt instead of regular JavaScript numbers?
A JavaScript number stays exact only up to 2^53 − 1; beyond that, converters built on parseInt silently round to the nearest double and hand you wrong digits with no error. This tool parses with BigInt end to end, so a full SHA-256 hex digest or a 64-bit pointer converts digit-for-digit exactly.
Are the values I convert uploaded anywhere?
No. Every conversion runs locally in your browser tab with native BigInt arithmetic — tool input is not sent to Toolk. Toolk's page analytics count page views, but they never receive the numbers, prefixes, or bit widths you enter here.
What does the signed overflow warning at 8-bit width actually mean?
Enter 200 in decimal and set Bit Width to 8: a signed 8-bit integer stops at 127, so the tool warns about overflow while still displaying the two's complement bits 1100 1000 — that byte pattern is unsigned 200 but reads back as −56 when interpreted signed. Same bits, two meanings.
How can I view a UUID or hash digest as binary or decimal?
Generate one with Toolk's UUID generator (/tools/uuid-generator), copy its 32 hex digits, then paste them here on the HEX tab. The identical 128-bit value appears in binary, octal, decimal, and any base up to 36 — no rounding, because BigInt carries the whole magnitude.