Bidirectional Base Converter - Decimal, Hex, Base32, Base64

Convert numbers between decimal and Base16 (hex), Base32, and Base64 in both directions, with automatic base detection. Encode a decimal or decode an encoded value.

Bidirectional Base Converter

Convert between decimal numbers and standard base encodings (Base16/Hex, Base32, Base64). Enter a value in either field to convert.

Enter a positive integer (max: 9,007,199,254,740,991)

Enter a Base16, Base32, or Base64 encoded value

About Base Encodings

Base16 (Hexadecimal): Uses characters 0-9 and A-F. Each character represents 4 bits. Commonly used for color codes and memory addresses.
Base32: Uses characters A-Z and 2-7. Each character represents 5 bits. Case-insensitive and human-readable.
Base64: Uses characters A-Z, a-z, 0-9, +, and /. Each character represents 6 bits. Commonly used for encoding binary data in text.
Safe Integer Limit: JavaScript can safely represent integers up to 9,007,199,254,740,991 (2^53 - 1) without precision loss.
📚

Documentation

Bidirectional Base Converter: Decimal ↔ Base16, Base32, Base64

A base converter turns a number from one way of writing it into another. Computers, URLs, and data formats rarely store a plain decimal number — they pack it into a more compact or transport-safe encoding such as Base16 (hexadecimal), Base32, or Base64. This tool converts both directions: type a decimal number and see its Base16/Base32/Base64 form, or paste an encoded value and get the decimal back. It also detects which base an encoded value is in.

What "base" means

Every positional number system has a base (or radix) — the number of distinct symbols it uses for a single digit. Decimal is base-10 (0–9). The encodings here trade a larger symbol set for a shorter string:

  • Base16 (Hexadecimal) — symbols 0-9 and A-F. Each character carries 4 bits. Ubiquitous for colour codes (#FF0000), memory addresses, and hashes.
  • Base32 — symbols A-Z and 2-7 (RFC 4648). Each character carries 5 bits. Case-insensitive and free of easily-confused characters, so it survives being read aloud or typed by hand.
  • Base64 — symbols A-Z, a-z, 0-9, +, and / (RFC 4648). Each character carries 6 bits. The standard way to carry binary data through text-only channels such as email or a JSON field.

The higher the base, the fewer characters the same number needs — but the larger the alphabet you have to keep straight.

How to use the converter

The tool has two fields and works in whichever one you type:

  • Decimal → encoded. Enter a positive whole number in the decimal field. The tool shows the value in Base16, Base32, and Base64 at once.
  • Encoded → decimal. Paste a Base16, Base32, or Base64 value in the encoded field. The tool detects the base, validates the characters, and returns the decimal number.

Range and validation

Values are limited to JavaScript's maximum safe integer, 9007199254740991 (that is 2^53 − 1). Above it, integers can no longer be represented exactly, so a converter that kept going would return silently wrong digits — the tool reports an out-of-range error instead of guessing. Decimal input must be a non-negative integer; encoded input must use only the characters valid for its base, or the tool flags it rather than decode garbage.

Worked examples

  • 255 in decimal. Base16 = FF, because 255 = 15×16 + 15 and both digits are F. This is why #FFFFFF is white: three bytes each at their maximum.
  • 1000 in decimal. Base16 = 3E8 (3×256 + 14×16 + 8 = 1000).
  • Decoding FF. Detected as Base16, decodes to 255.
  • A byte at maximum, 8 bits, is FF in hex — one hex character per 4 bits, so two characters per byte. The same byte needs a longer string in Base32 and a padded group in Base64, which is why hex stays the readable choice for short values like colours and addresses.

Where each encoding is used

  • Base16 — CSS/HTML colours, MAC and IPv6 addresses, cryptographic hashes and checksums, hex dumps of binary files.
  • Base32 — TOTP/2FA secret keys, some file-sharing and DNS-based systems, human-typed or spoken identifiers where case and character confusion must be avoided.
  • Base64data: URIs, email attachments (MIME), embedding images or certificates inside JSON or XML, JWT tokens.

Because each encoding is just a representation of the same underlying number, converting between them never changes the value — only how many characters it takes to write it down and which channels it can safely travel through.

🔗

Related Tools

Discover more tools that might be useful for your workflow