A Base64 to hex string conversion replaces each decoded byte with exactly two lowercase hexadecimal digits, preserving the underlying byte sequence.

For strict byte-level work, use the Base64 to Hex Converter. It accepts canonical padded RFC 4648 Base64 or continuous hexadecimal byte pairs, converts up to 500,000 decoded bytes entirely in your browser, and rejects malformed input instead of returning a partial result.

base64 to hex string
Base64 to Hex String: RFC 4648 Byte Mapping

How the byte representation changes

Base64 is not a direct one-character-to-one-hex-digit substitution. Standard Base64 groups the source bytes in sets of three and represents each group with four characters. Hexadecimal renders each byte independently with exactly two digits. A correct conversion therefore decodes the Base64 into bytes first and then expresses those bytes in hexadecimal.

This structure is defined in RFC 4648. The converter works from byte values rather than treating the encoded text as meaningful language, so it does not automatically turn the result into UTF-8, JSON, numbers, or another interpretation. The reverse direction accepts hexadecimal bytes and produces standard padded Base64 for the same sequence.

Input profile Formatting rules Supported by this converter
Canonical RFC 4648 Base64 Uses letters, digits, +, and /; the total length is a multiple of four; required = padding appears only at the end; no whitespace Yes, for Base64-to-hex conversion
Base64url Uses - and _ instead of + and /; padding is often omitted No; use a converter with a base64url profile
MIME-wrapped Base64 May contain line breaks or be enclosed by MIME headers No; the strict parser rejects whitespace and extra container characters
Hexadecimal bytes Continuous pairs using 0–9, A–F, or a–f; no prefix, separators, or whitespace Yes, for hex-to-Base64 conversion

Confirm the source profile before converting. A string containing - or _ is not standard Base64, and a wrapped string may need a MIME-aware decoder rather than this byte-level workflow.

Convert a Base64 string to hexadecimal

  1. Identify the source encoding. Confirm that the value uses standard RFC 4648 Base64 with the + and / alphabet. Do not treat base64url, line-wrapped Base64, or a value containing surrounding headers as the same format.
  2. Choose the correct direction. In the Base64 to Hex Converter, select Base64 to hexadecimal. Paste canonical, padded Base64 without spaces, tabs, or line breaks. The complete input must have a length divisible by four, with any required = characters at the end.
  3. Run the conversion. The converter validates the alphabet, input length, required padding, and zero pad bits before producing hexadecimal. If it reports a malformed value, correct the source rather than ignoring the error or accepting a partial conversion.
  4. Check the byte count and important bytes. Compare the decoded byte length with a length supplied by the original system or specification. Inspect leading bytes carefully, because each leading zero byte must remain visible as 00 in hexadecimal.
  5. Copy the exact result. Use the copy action after verification. It copies only the converted hexadecimal value, without labels or explanatory text.

Input rules that prevent silent corruption

The Base64 decoder is intentionally strict. Its input length must be a multiple of four, required equals-sign padding must be present, padding may appear only at the end, and whitespace is not ignored. Every character must belong to the standard Base64 alphabet. These rules help distinguish a canonical value from a different profile or a mistyped input.

The converter also decodes and re-encodes the bytes to reject nonzero pad bits in the final Base64 quantum. Such bits can allow more than one textual spelling to represent the same bytes. A strict canonical check is useful when comparing signed data, protocol fixtures, cache keys, or exact serialized values.

Base64url is not accepted silently. Its - and _ characters belong to a different alphabet, and its padding conventions can differ. Similarly, a decoder that accepts wrapped or unpadded Base64 is operating under a separate profile; successful decoding there does not guarantee that this converter will accept the same text.

Hexadecimal input follows an equally explicit rule: there must be exactly two digits per byte, with no 0x prefix, separators, whitespace, or underscores. An odd trailing nibble is rejected. Uppercase and lowercase hex digits are both accepted, but the hexadecimal output is always lowercase.

Verify byte count and leading zero bytes

When the original byte length is not already known, the decoded length of canonical Base64 can be checked with this formula: decoded bytes = 3 × (total Base64 characters ÷ 4) − number of = characters. The number of hexadecimal characters should then be exactly twice the decoded byte count.

For example, Zg== contains four Base64 characters and two padding characters, so its decoded length is 3 × (4 ÷ 4) − 2 = 1 byte. Its exact hexadecimal output is 66.

Do not trim leading zero bytes from the hexadecimal result. They are part of the byte sequence and can determine the correct length, alignment, or representation in the receiving application. Likewise, compare hexadecimal values exactly: output case is normalized to lowercase, but the digits themselves still carry the complete byte value.

Reverse the conversion without changing bytes

To turn hexadecimal bytes into Base64, use the same converter’s hexadecimal-to-Base64 direction. Paste a continuous sequence containing exactly two hex digits per byte, with no prefix, separators, whitespace, or odd trailing nibble. Run the conversion, verify the expected byte count, and copy the result.

The output uses standard padded Base64. When the hexadecimal came from a canonical Base64 value, converting it back should reproduce the exact original Base64 text. Base64 is case-sensitive, so compare the complete string rather than checking only its length or treating uppercase and lowercase letters as equivalent.

Limits, privacy, and intended uses

The underlying decoded byte sequence is limited to 500,000 bytes to bound browser memory and output size. Output is never silently truncated. Malformed input produces a specific error without a partial result, which makes unexpected length or padding problems visible instead of hiding them in the output.

All byte-level conversion happens locally in the browser, and the input is not uploaded. The tool is intended for inspecting encoded payloads, protocol fields, test fixtures, hash bytes, binary identifiers, and small data samples. It converts hash bytes if they are already present; it does not calculate a hash or checksum.

Base64 and hexadecimal are reversible encodings, not encryption, hashing, signing, compression, authentication, or access control. The output exposes exactly the same bytes as the input. Converting a credential, token, private key, personal record, or other secret therefore does not protect it. Keep sensitive values out of untrusted clipboards, logs, screenshots, issue trackers, analytics fields, and shared browser sessions.

A valid conversion is not semantic validation

The converter does not interpret the bytes as UTF-8, numbers, certificates, images, JSON, cryptographic keys, checksums, or files. It also does not add MIME headers, data-URL prefixes, line wrapping, or checksum fields. If an application expects one of those containers, use the converted bytes as one layer and validate the surrounding format separately.

A successful conversion confirms that the representation is valid and that the same bytes were rendered in the requested form. It does not prove that those bytes are the intended message, file, key, or protocol field. For security-sensitive work, compare the final representation with the governing specification or an official test vector, especially when exact spelling, padding, and leading zero bytes matter.

For a deeper look, see CRC32 Calculator for Large Text: 5,000,000 Bytes.

For a deeper look, see File to Base64 Explained: Bytes, Padding, and Workflow.