Skip to content
ZeroServer.tools

Base Converter

Local processing guarantee: Real-time math calculated completely locally inside your browser.

Decimal

Denary (Base 10)

Binary

Radix 2 (Base 2)

Hexadecimal

Hex (Base 16)

Octal

Oct (Base 8)

Custom Base (Base 3)

Supports Radix 2 to 36
Base 3
21936
Base 3 uses digits 0-2.

Understanding Numeric Base Systems

In computing and mathematics, a base (or radix) is the number of unique digits, including zero, used to represent numbers in a positional numeral system. While humans traditionally use the decimal system (Base 10) due to having ten fingers, digital electronics rely exclusively on the binary system (Base 2) representing electrical on/off states (1 and 0).

Hexadecimal (Base 16)

Hexadecimal is widely used in computer science because it can represent 4 binary bits (one nibble) as a single character. It utilizes digits 0-9 and lettersA-F (representing 10-15). For example, hex FF equals decimal 255.

Octal (Base 8)

Octal numbers use digits 0-7. Historically popular for PDP-11 systems and UNIX file permissions, where each octal digit represents exactly 3 bits. For example, permission 755 corresponds to binary111 101 101.

Fractional Conversions

Converting fractional values (digits after the decimal dot) involves multiplying the fractional remainder by the target base, extracting the integer part as the next digit, and repeating the process on the remaining fraction. Some base-10 fractions (like 0.1) become infinite recurring fractions in base-2 (0.000110011...).

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Converting a number between any two bases from 2 to 36.
  • Checking a value's representation in an unusual base.
  • Converting a base-36 identifier back to decimal.
  • Working through a base-conversion exercise.
  • Converting between two non-decimal bases in one step.

How it works in practice

A worked example

A 64-bit mask has come out of a log in hexadecimal and the ticket needs it in decimal, exactly, with no rounding anywhere.

Input
Hex  FFFFFFFFFFFFFFFF
Output
Binary   1111111111111111111111111111111111111111111111111111111111111111
Octal    1777777777777777777777
Decimal  18446744073709551615
Base 3   11112220022122120101211020120210210211220

That decimal ends in 615, and getting there is the whole point. The integer part is parsed and rendered with arbitrary-precision integers rather than the language's ordinary numbers, so every digit is exact at any width — the binary column is sixty-four ones, which is what a full 64-bit mask should look like and is a useful sanity check in itself. The custom base at the bottom takes any radix from two to thirty-six, so an unfamiliar encoding can be read without hunting for a second tool.

The edge case that catches people

Try the same value in a browser console and it comes back as 18446744073709552000. Ordinary JavaScript numbers are double-precision floats with fifty-three bits of integer precision, so anything larger is silently rounded to the nearest representable value — and the result still looks like a plausible number, which is what makes it dangerous. Sixty-four-bit identifiers, flag masks and timestamps in nanoseconds all live above that line, so a converter built on the obvious functions is wrong for exactly the inputs people reach for it with.

When not to use this tool

Fractions are the honest exception. An integer converts exactly in any base, and a fractional part does not — a tenth is a repeating expansion in binary just as a third is in decimal, so the digits after the point are an approximation truncated at some length and converting back may not return what you started with. If a value has a fraction and the exactness matters, keep it as a scaled integer and convert that instead. Money is the everyday case: count cents, not dollars.

Frequently Asked Questions

Which bases are worth knowing?
Binary for bit-level work, octal because three bits map exactly onto one digit — which is why chmod uses it — hexadecimal because four bits map onto one digit, and base 36 for compact identifiers. Everything else is a curiosity rather than a convention.
Why is hex the default for bytes?
Because a byte is exactly two hex digits, so a dump aligns perfectly and every boundary is visible. Decimal needs one to three digits per byte and never aligns, which is why no hex editor has ever shown decimal by default.
How large a number can be converted exactly?
Past 2⁵³ an ordinary JavaScript number loses precision silently, which is why arbitrary-precision arithmetic matters here — a converted value that is off in its last digits looks entirely plausible and is wrong.
Are digits above 9 case-sensitive?
By convention no — `FF` and `ff` are the same hex value. Above base 36 case has to become significant, since the alphabet runs out, which is why base 62 and base 64 alphabets specify their ordering explicitly rather than relying on convention.
Why does 0.1 have no exact binary form?
Because a fraction terminates in a base only when its denominator's prime factors divide that base. Ten factors into 2 and 5, and binary has only the 2 — so a tenth repeats forever, which is the origin of 0.1 + 0.2 not equalling 0.3.

Common errors and gotchas

  • Not stating the source base, where a digit string is valid in several and means different things in each.
  • Assuming case matters above base 10, when most implementations treat letters case-insensitively.
  • Including a digit the base does not have, such as a 9 in base 8.
  • Losing width information, so a mask's leading zeros disappear.
  • Converting a fractional value and expecting it to terminate in the target base.

Related Encoders & Decoders tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate