Skip to main content

Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36. Paste a value, pick the bases and copy the result in your browser.

Value

Stays in your browser

Whole numbers only (no decimals). Handles arbitrarily large values.

Result (base 16)

Enter a number and press Convert.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Online Number Base Converter

Convert a number between any two bases from 2 to 36 — binary, octal, decimal, and hexadecimal are common presets, but any base in that range works. Useful for reading memory dumps and bit flags, converting color codes, or just checking what a hex literal actually equals in decimal. Handles arbitrarily large whole numbers via BigInt. It helps developers inspect protocol values and convert numbers between binary, octal, decimal, hexadecimal, and other bases.

What is a number base (radix)?

A number's base — also called its radix — determines how many unique digits are used to represent values and what each digit position is worth. Decimal (base 10) is what people use day to day; binary (base 2) is how computers represent everything at the hardware level; hexadecimal (base 16) is a common shorthand for binary data because each hex digit maps to exactly 4 bits. This tool converts a value between any two bases from 2 to 36.

How to convert a number between bases

Enter a value in the input box, choose its current base under From base and the base you want under To base, then click Convert. Use the swap button to instantly reverse direction, or pick any base from 2 to 36 under "All bases" if you need something beyond the common presets.

Common use cases

  • Converting a hex literal from source code into decimal to understand its actual value
  • Reading raw memory dumps or register values shown in hexadecimal or binary
  • Decoding bit flags, where each binary digit represents an on/off setting
  • Converting color codes between hex (e.g. #FF5733) and decimal RGB components

Conversion is handled with BigInt internally, so arbitrarily large whole numbers convert accurately without losing precision the way JavaScript's regular number type would beyond 2^53.

Worked example

255 (decimal) converts to FF in hex, and back again to 255 in decimal. A much larger value, 123456789012345678901234567890 (base 10), converts correctly to BYW97UM9S91DLZ68TSI in base 36 — far beyond what a regular JavaScript number could represent without losing precision.

Common mistakes and edge cases

  • If your input has more than one invalid digit for the chosen base, the error reports only the first one it hits, scanning left to right — in testing, "129" read as binary reports "2" as invalid, not "9", even though both are. Expect to fix and re-check more than once on messy input.
  • Letters are treated case-insensitively as digits (a=10 through z=35), so base 36 uses every letter of the alphabet as a valid digit — there's no separate "letter" concept once you're past base 10.

Frequently asked questions

What bases does this converter support?
Any base from 2 to 36 — not just the common presets (binary, octal, decimal, hexadecimal). Base 36 uses digits 0-9 followed by letters a-z, the maximum range JavaScript's built-in number formatting supports.
Can I convert negative numbers?
Yes, using sign-and-magnitude — a leading minus sign is preserved through the conversion. Two's-complement negative representation isn't supported, since that requires a fixed bit width that doesn't have a well-defined meaning across arbitrary bases.
Does this handle numbers too large for a normal JavaScript number?
Yes — conversion uses BigInt internally, so arbitrarily large whole numbers convert correctly instead of losing precision the way JavaScript's regular Number type would beyond 2^53.
Can I convert decimal fractions, like 3.14?
No — this tool handles whole numbers (integers) only. Fractional values don't convert cleanly across arbitrary bases the way integers do, so fractional input isn't supported.
If my input has more than one invalid digit, which one does the error report?
The first one it encounters scanning left to right — checked in testing, entering "129" as binary reports "2" is not a valid digit for base 2, not "9", even though both are invalid for base 2. Fix the reported digit and re-check; there may be more after it.
How do I convert binary to hex?
Enter the binary number, choose base 2 as the source and base 16 as the target. Each group of four bits becomes one hex digit, so 1111 0000 is F0. If you type a digit that does not belong to the base, such as a 2 in binary, you get an error rather than a wrong number.

Related tools

More Code & Conversion

View all Code & Conversion tools →