Base64 to Hex Converter
Base64 to Hex Converter. Paste your string into Base64 Input and the Base64 to Hex Converter instantly decodes it back to Hex Output. The hex to decimal converter takes the value in the Hex Input field and returns its exact base-10 equivalent in the Decimal Output field, even for very large numbers.
Paste a string into this online base64 to hex converter and you get the matching hexadecimal bytes back in a moment, with no upload and no install. It decodes your text into raw bytes first, then writes every byte as two hex digits, so a value like WmVicmEtNDI= turns into 5A656272612D3432 that you can read, compare and paste straight into a debugger, a config file or an API request.
How a Base64 to Hex Converter Works
Base64 and hex are two ways of writing the same binary data as printable text. Base64 is a binary-to-text encoding scheme built on an alphabet of 64 characters: A-Z, a-z, 0-9, plus + and /, with = reserved as padding. Hexadecimal is a base-16 numeral system that uses 0-9 and A-F. Because neither one changes the underlying bytes, switching from one to the other is lossless: you decode, then re-encode. The fastest way to get a base-8 result from a decimal number is to run it through the decimal to octal converter.
The tool above runs both steps in your browser. Nothing is sent to a server, because the whole calculation is client-side, so tokens, keys and other sensitive strings never leave your machine. When you need the opposite direction, a hex to base64 converter reverses the same two steps, and the reverse conversion always returns your original input.
What each field does
- Base64 string: the encoded text you paste in, with or without trailing padding characters.
- Letter case: choose uppercase (A-F) or lowercase (a-f) for the hex output.
- Delimiter: separate each byte with a space, a comma, or nothing at all.
- Convert, copy and reset: run the conversion, copy the result, or reset the form to start over.
Base64 to Hex Conversion Step by Step
Every Base64 character stands for a 6-bit value from 0 to 63, while every hex digit stands for a 4-bit value from 0 to 15 (a nibble). The two sizes line up neatly: four characters of Base64 carry 24 bits, which is exactly three bytes, and those same 24 bits are six hex digits. That shared 24-bit boundary is why the conversion never needs rounding.
- Look up each character in the Base64 alphabet to get its 6-bit value.
- Join the bits into one continuous stream and drop any bits that came from padding.
- Cut the stream into 8-bit groups to recover the original bytes.
- Write each byte as two hex digits, one for each 4-bit half, and concatenate them.
The size relationship is simple enough to write as a formula. Two hex digits describe one byte, and every full group of four Base64 characters describes three bytes, minus one byte for each = sign at the end:
A 12-character Base64 string with one = therefore holds 8 bytes and produces 16 hex digits, which is why the result is always longer than the input: hex needs two characters per byte where Base64 needs about 1.33.
Base64 Decode Worked Example: Zebra-42
Take the ASCII text Zebra-42, which is 8 characters and therefore 8 bytes. Encoded in Base64 it becomes WmVicmEtNDI=. To see the decoding by hand, look at the first four characters, WmVi:
| Base64 character | Index | 6-bit value |
|---|---|---|
| W | 22 | 010110 |
| m | 38 | 100110 |
| V | 21 | 010101 |
| i | 34 | 100010 |
Joined, those 24 bits read 010110100110010101100010. Regrouped into bytes they become 01011010, 01100101 and 01100010, which are 5A, 65 and 62 in hex: the letters Z, e and b. Repeating the process for the remaining characters gives the full hexadecimal result 5A656272612D3432, and the trailing = only tells the decoder that the final group held two bytes instead of three.
More Base64 string to hex string examples
| Base64 string | Decoded bytes | Hex string |
|---|---|---|
| WmVicmEtNDI= | Zebra-42 | 5A656272612D3432 |
| S2V5Nw== | Key7 | 4B657937 |
| UGluZyA0MjE3 | Ping 4217 | 50696E672034323137 |
| 3q2+7wA= | raw binary, 5 bytes | DEADBEEF00 |
The last row is raw binary with no printable text at all, which is where a hex view earns its keep: you cannot read those bytes as letters, but you can read them as DE AD BE EF 00.
Why Convert Base64 to Hex
Developers reach for hex whenever they need to look at bytes rather than ship them. Base64 packs data tightly, so it is the better choice for sending it, but hex lines up one-to-one with the bytes underneath, which makes it the better choice for inspecting them. When validating that a file or packet wasn't corrupted, the hex crc-32 calculator computes the same checksum used in ZIP and Ethernet.
Readability and debugging
Readability is the main reason. Two hex digits always equal one byte, so you can count offsets, spot repeated patterns and see exactly where a value changes. That makes hex the default view for debugging, binary inspection, protocol analysis of network packets, data recovery from damaged files and reverse engineering of unknown formats.
Compatibility with other systems
Compatibility is the second reason. Low-level programming, embedded systems and IoT firmware work with memory addresses and byte values written in hex, and many command-line tools and hardware datasheets expect it too. Hex is also the usual way to show checksums and digests, so a Base64 value from an API has to be converted before it can be compared against a published one.
Security and cryptography
In cryptography and cybersecurity work, a SHA256 hash, an HMAC signature, a set of keys or a PEM block of certificates often arrives in Base64 but gets verified in hex. The same goes for digital signatures and for the parts of a JWT or OAuth token. Remember that decoding is not decrypting: an encrypted payload stays unreadable after conversion, you simply see its ciphertext bytes.
Checking a SHA-256 Digest with Base64 to Hex Conversion
A build engineer is about to install an internal package. The lockfile lists its integrity value in Base64, K194Zyye8hi1PHsVEOb9WBZUsqtfgEyJngkS1cc6wyk=, but the release page publishes its SHA-256 checksum as hex: 2B5F78672C9EF218B53C7B1510E6FD581654B2AB5F804C899E0912D5C73AC329. The two strings look nothing alike, so nobody can compare them by eye.
Before converting anything, they count. The Base64 value is 44 characters ending in a single =, so by the formula it holds (3 × 44 ÷ 4) − 1 = 32 bytes. A SHA-256 digest is defined as 256 bits, which is also 32 bytes, so the lengths agree and the hex form should run to 64 digits.
They paste the lockfile string into the converter, choose uppercase to match the release page, set the delimiter to none, and press convert. The output reads 2B5F78672C9EF218B53C7B1510E6FD581654B2AB5F804C899E0912D5C73AC329. They check the length (64 digits) and then compare the first eight digits, 2B5F7867, and the last eight, C73AC329, against the published checksum. Both ends match, and so does everything in between, character for character.
That match is what the engineer needed. It shows that the artifact the lockfile points to is the one the release page describes, so the install goes ahead. Had one digit differed, the next step would be to discard the download and fetch it again from the original source, since a SHA-256 mismatch cannot be a rounding or formatting issue.
Base64 to Hex in JavaScript, Python and Java
When you need the same base64 to hexadecimal result inside your own program, every mainstream language can do it in a line or two. These snippets all decode the example string and print 5A656272612D3432 (in the case each library prefers).
JavaScript
In Node.js, Buffer.from reads the Base64 and toString("hex") writes the hex. In a browser, atob() decodes to a binary string that you then loop over, padding each character code to two digits.
Buffer.from("WmVicmEtNDI=", "base64").toString("hex");
// "5a656272612d3432"Python
Python's base64 module decodes the string and binascii.hexlify (or the bytes method .hex()) produces the hex.
import base64, binascii
binascii.hexlify(base64.b64decode("WmVicmEtNDI=")).decode()
# "5a656272612d3432"Java and the command line
In Java, decode with java.util.Base64 and format each byte with %02X. On the command-line, Linux and macOS users can pipe base64 -d into xxd -p, while Windows has certutil for the same job.
Hex Encoding vs Base64 Encoding
Both are an encoding scheme for bytes, but they trade size for clarity. Hex encoding uses two characters per byte, so it is 100% larger than the raw data. Base64 encoding uses four characters for every three bytes, so it is about 33% larger, which saves bandwidth in data transmission. That is why Base64 shows up in email through MIME, in HTTP headers, and in JSON or XML documents used for data serialization, all of which are text-based formats that cannot carry arbitrary bytes safely.
URL-safe Base64 and character sets
The URL-safe variant, Base64URL from RFC 4648, replaces + and / with - and _ and usually drops the padding. Swap those two characters back before decoding if your input came from a URL or a token. Text inside the bytes is normally UTF-8, so a single accented letter may occupy more than one byte and produce more than two hex digits.
Hexadecimal, Binary and ASCII Basics
A binary number is a sequence of 0s and 1s, and every computer ultimately stores binary data that way. People find long runs of 0s and 1s unreadable, so hexadecimal acts as a shorthand: each hex digit replaces exactly four binary digits, which is why 11111111 collapses to FF. That compression is the reason hexadecimal became the standard notation in programming, in memory dumps and in network tooling. It is also why every base64 to hex conversion ends with decoded bytes shown as pairs of hex digits.
Where ASCII fits in
ASCII maps 128 characters to numbers, so the capital letter Z is 90, which is 5A in hex, and the digit 4 is 52, which is 34 in hex. That is why the ASCII string Zebra-42 becomes 5A 65 62 72 61 2D 34 32. Text written in ASCII shows up in the hex output as values between 20 and 7E, so you can often spot readable words hiding inside an otherwise opaque dump.
Reading a hex dump
- Printable ASCII text appears as hex values from 20 to 7E.
- Runs of 00 usually mark padding, empty fields or the end of a binary string.
- Repeated values often reveal a header, a magic number or a fixed-width field in the binary data.
- Values above 7F show that the content is not plain ASCII and may be compressed, encrypted or UTF-8.
Using This Free Online Tool for Everyday Tasks
This free online tool is built for quick, repeatable jobs where opening a script would be overkill. You do not need an account, and because the work happens in your browser, even large pasted strings convert instantly without waiting on a server. A file encoded in Base64 can be pasted in as text, though for very large files a command-line decoder is usually the better fit.
Typical jobs
- Comparing a Base64 digest from an APIs response with the hex checksum on a download page.
- Reading the raw bytes behind a Base64 field in a JSON payload during programming or testing.
- Checking that a hex string you generated matches what another system encoded.
- Preparing key material or test vectors for cryptography libraries that insist on hex input.
Letter case and delimiter options
Different systems are picky about hex style. A hash printed by a Linux tool is usually lowercase, while a hardware datasheet may use uppercase pairs separated by spaces. Set the letter case and delimiter before you copy the output, and the result will match whatever text-based format the next step expects, so you never have to reformat it by hand. Because encoding style does not change the underlying value, 4b, 4B and 4B 65 are all the same bytes written differently.
A good habit is to run every conversion in both directions at least once. If a base64 to hex conversion followed by the reverse returns your original string, the encoding and the decoding both worked, and you can trust the hex string you are about to paste into a test, a ticket or a pull request. Teams that handle base64 to hex work daily often keep a short list of known-good pairs, such as the table above, to sanity-check new tooling in seconds.
Where Base64 Encoding Is Used in Practice
Base64 encoding is everywhere data has to cross a text-only boundary. Email attachments, inline images in HTML, and credentials in HTTP Basic authentication all use it. Configuration files store certificates and keys as Base64 so they survive copy and paste, and a JWT carries each of its three sections in the URL-safe variant. In each case a developer sooner or later wants to see the underlying bytes, and base64 to hex conversion is how you see them: a decode base64 step followed by a hex view reveals what an attachment, a JWT or a certificate really contains.
The reverse is just as common. A hexadecimal fingerprint from a security scanner might have to go into a field that only accepts Base64, and a hex to base64 converter does that job with the same two steps in the opposite order. Knowing both directions means you can move between formats without ever guessing which one a given system wants, and without risking silent corruption from a hand-edited string. Since both are only different spellings of the same binary data, moving between them in either direction never costs you a single bit.
Fixing Base64 Decoder Errors
Most failed conversions come down to a few causes, and a quick data validation pass catches nearly all of them before you debug anything deeper.
Padding with the equals sign
A valid Base64 length is a multiple of four. If it is not, the missing padding was stripped somewhere, and you can restore it by appending one or two = signs until the length fits.
Wrong alphabet or stray characters
- Line breaks every 76 characters are normal in MIME and should be ignored.
- A
-or_means the string is Base64URL, not standard Base64. - Any character outside the 64-character alphabet (and
=) makes the string invalid. - Whitespace copied from a chat or a PDF is the most common invisible culprit.
Finally, keep integrity in mind: if you decode, edit and re-encode, a single changed byte changes the hex digits for that byte only, and nothing else, which is a handy way to confirm that a conversion did what you expected. If you want to check one against the other, the hello test string SGVsbG8= is short enough to verify by eye.