Skip to content
Free tool · no signup

Number Base Converter

Convert between binary, octal, decimal and hexadecimal — hex to decimal, decimal to hex, binary to decimal and every other pairing — all at once. Enter a value in any base (or let it auto-detect a 0x, 0b or 0o prefix), and copy the result in each base. Arbitrarily large integers are exact via BigInt, with an optional two's-complement view. Everything runs in your browser; nothing is uploaded.

Input base

Runs entirely in your browser with native BigInt math — arbitrarily large numbers are exact, and nothing you type is ever sent to a server.

TL;DR

What this tool is

  • A free, in-browser converter between the four bases you actually use: binary (base-2), octal (base-8), decimal (base-10) and hexadecimal (base-16).
  • Type a value in any base — hex to decimal, decimal to hex, binary to decimal, or anything to anything — and see it in all four bases at once, each one copyable with a prefix (0x / 0b / 0o).
  • Auto-detects the input base from a 0x, 0b or 0o prefix, or pick the base explicitly; digits are grouped (binary in 4s, hex in 2s) so long values stay readable.
  • Backed by native BigInt math, so arbitrarily large integers convert exactly — no 53-bit floating-point rounding, no silent precision loss on a 256-bit key or hash.
  • Optional two’s-complement view renders the 8/16/32/64-bit pattern for negative numbers. Everything runs client-side; nothing you enter is sent to a server.

How number bases work

Every integer can be written in any base (or radix) without changing its value — only its spelling. A base is positional: each digit carries a weight equal to the base raised to the digit's position, counting from zero on the right. In decimal (base-10), 255 is 2×10² + 5×10¹ + 5×10⁰. The same quantity is 0xff in hexadecimal (base-16, digits 0–9 then a–f), 0o377 in octal (base-8), and 0b11111111 in binary (base-2). Converting between bases just re-expresses that single number.

The four bases, briefly

  • Binary (base-2). Digits 0 and 1 — the native language of hardware. One binary digit is a bit; eight bits are a byte. Used for flags, bitmasks, protocol headers and the bit math behind subnetting.
  • Octal (base-8). Digits 0–7, each mapping to exactly three bits. Mostly seen today in Unix file permissions (chmod 755).
  • Decimal (base-10). The everyday human base — how most results are finally reported.
  • Hexadecimal (base-16). Digits 0–9 then a–f. Each hex digit is exactly four bits (a nibble), and two hex digits are one byte — which is why hashes, keys, memory addresses and byte dumps are written in hex.

Why BigInt matters

A converter that does its math in a normal JavaScript number corrupts anything past 2⁵³ — roughly 15–16 decimal digits — because a double-precision float cannot represent larger integers exactly. That silently turns a 256-bit hash or key into a wrong value with no error. This tool uses native BigInt throughout, so a value of any size converts digit-for-digit exactly.

Signed numbers & two's complement

Hardware stores signed integers in two's complement: within a fixed bit width, a negative value is the bit pattern you get by inverting the positive value's bits and adding one. In 8-bit, -1 is 11111111 (0xff) and -42 is 11010110 (0xd6). Toggle the two's-complement option and choose a width to see that pattern; by default negatives are shown in plain sign-magnitude form instead.

Quick reference

DecimalHexOctalBinary
00x00o00
80x80o101000
100xa0o121010
160x100o201 0000
420x2a0o5210 1010
2550xff0o3771111 1111
37359285590xdeadbeef0o336533373571101 1110 1010 1101 1011 1110 1110 1111

Security note: Because every conversion happens locally in your browser, you can decode hex or binary pulled from an untrusted sample — a packet capture, a malware string, a CTF artifact — without that data ever touching a server. The exact BigInt math also means a cryptographic value survives the round trip intact, so a hash or key you convert here is the one you can safely paste onward.

Number Base Converter — animated demo
A quick look at Number Base Converter — it runs entirely in your browser.

Frequently asked questions

How do I convert hex to decimal (or decimal to hex)?

Type the value into the input and press Convert — the tool shows it in binary, octal, decimal and hex simultaneously, so a single conversion covers hex-to-decimal, decimal-to-hex and every other pairing at once. For hex you can type the digits directly (ff) or with the 0x prefix (0xff); with Auto-detect on, the 0x prefix selects base-16 for you. The decimal row is the plain base-10 value (0xff = 255), and the hex row is the base-16 value of whatever you entered (255 = 0xff). Each row has a Copy button that includes the conventional prefix.

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

In a positional (place-value) system, each digit is multiplied by the base raised to its position. In decimal (base-10) the number 255 means 2×10² + 5×10¹ + 5×10⁰. The same value in hex (base-16) is ff — 15×16¹ + 15×16⁰ — and in binary (base-2) it is 11111111 — eight 1s, each a power of two. Converting between bases does not change the quantity, only how it is written: 255, 0xff, 0o377 and 0b11111111 are the identical number. This tool reads your input into an exact integer and then re-renders that one integer in all four bases.

Can it handle very large numbers like a 256-bit hash or key?

Yes. The converter uses JavaScript BigInt for all arithmetic, so there is no 2⁵³ safe-integer ceiling and no floating-point rounding — a 256-bit, 512-bit or larger value converts digit-for-digit exactly. This matters in security work: a naïve converter that routes through a double-precision float will silently corrupt anything past 15–16 significant decimal digits, turning a cryptographic value into a wrong one without any error. Paste the whole hex string and the decimal/binary/octal forms will be precise.

What does the two’s-complement option do with negative numbers?

By default a negative input is shown in sign-magnitude form — a leading minus in front of the magnitude in each base (for example -0x2a). Real hardware and most binary file formats instead store signed integers in two’s complement, where a negative value is encoded as its bit pattern within a fixed width. Turn on the two’s-complement option and choose a width (8, 16, 32 or 64 bits) to see that pattern: -1 in 8-bit two’s complement is 11111111 (0xff), and -42 in 8-bit is 11010110 (0xd6). If the value does not fit the chosen width, the tool shows the wrapped low bits and warns you to widen it.

Where do these bases show up in security and CTF work?

Everywhere. Hex is the default for bytes — hashes, keys, memory addresses, packet dumps, file signatures (magic bytes) and shellcode are all read in hex. Binary matters for bit-level work: flags and bitmasks in protocol headers, permission bits, and the bit math behind subnetting and CIDR. Octal survives in Unix file permissions (chmod 755). Decimal is how most of it is finally reported. Reverse-engineering, exploit development, forensics and almost every CTF challenge involve hopping between these representations, which is exactly what this converter is for. It runs entirely in your browser, so you can convert data from an untrusted sample without it ever leaving your machine.

🎉 New here? Use code WELCOME10 for 10% off any plan at checkout
Number Base Converter — Hex, Decimal, Binary & Octal Converter · PlayCISO