How to get an MD5 hash in Base64
- MD5 is preselected under Algorithm.
- For a file, switch Input to File and drop it, or several files at once; each gets its own result. Files above 200 MB are read in 8 MB chunks with a progress percentage.
- For text, keep Input on Text and type or paste. Input is lets you hash hex or Base64 data as raw bytes instead of as UTF-8 text.
- Copy the Base64 value for headers and APIs, or Hex to compare with
md5sumoutput. Both describe the same 16 bytes.
The tool shows a short warning that MD5 is unfit for security purposes, which is accurate and does not affect checksums.
Hex or Base64: the same 16 bytes
| Input | MD5 (hex) | MD5 (Base64) |
|---|---|---|
| empty | d41d8cd98f00b204e9800998ecf8427e | 1B2M2Y8AsgTpgAmY7PhCfg== |
hello | 5d41402abc4b2a76b9719d911017c592 | XUFAKrxLKna5cZ2REBfFkg== |
The quick brown fox jumps over the lazy dog | 9e107d9d372bb6826bd81d3542a419d6 | nhB9nTcrtoJr2B01QqQZ1g== |
The most common mistake with Content-MD5 is Base64-encoding the hex text. For the fox sentence that produces OWUxMDdkOWQzNzJiYjY4MjZiZDgxZDM1NDJhNDE5ZDY=, 44 characters that no server will accept. The length tells you at a glance: 24 characters is right, 44 is the hex encoded by mistake.
Where Base64 MD5 is expected
Content-MD5request headers (RFC 1864). Amazon S3 checks it on uploads, and Azure Blob Storage does too, returning an error when the body does not match.- Google Cloud Storage reports an object’s
md5Hashin Base64, andgsutil hashprints Base64 unless you pass-hfor hex. - Azure Blob properties store
Content-MD5in Base64 as well. - Older APIs and email systems that adopted the header before SHA-based checksums existed.
Other places stay with hex: md5sum and most download pages, and the ETag of a single-part S3 upload, which is the hex MD5 in quotes. Multipart S3 ETags end in - and a part count and are not an MD5 of the whole file at all, so they will never match this tool’s result.
MD5 to Base64 on the command line and in code
openssl md5 -binary file.bin | base64
md5sum file.bin | cut -d' ' -f1 | xxd -r -p | base64
import base64, hashlib
with open("file.bin", "rb") as f:
digest = hashlib.file_digest(f, "md5").digest()
print(base64.b64encode(digest).decode())
hashlib.file_digest needs Python 3.11 or newer; on older versions read the file in chunks and call update(). In Node.js, crypto.createHash("md5").update(buffer).digest("base64") gives the Base64 form directly. If a newer API offers a SHA-256 checksum instead, prefer it; SHA-256 to Base64 produces those values the same way. More snippets live on the OpenSSL and Python pages.
FAQ
What is the Content-MD5 header?
An HTTP header from RFC 1864 that carries the Base64 of the 16-byte MD5 digest of the body. Storage services such as Amazon S3 and Azure Blob Storage use it to reject uploads that were corrupted in transit.
Why is my Base64 MD5 44 characters long?
You encoded the 32-character hex string instead of the 16 raw bytes. A correct MD5 in Base64 is always 24 characters ending in ==. Hash with a binary output (-binary in OpenSSL, .digest() in Python) before encoding.
How do I convert an MD5 hex checksum to Base64?
Decode the hex to bytes and Base64-encode them: 9e107d9d372bb6826bd81d3542a419d6 becomes nhB9nTcrtoJr2B01QqQZ1g==. The hex to Base64 converter does it in one paste.
Is MD5 still safe to use?
For detecting accidental corruption, yes. For anything an attacker could influence, no: MD5 collisions can be produced on a laptop, so two different files can share a hash. Use SHA-256 for integrity against tampering and a password hash such as Argon2 or bcrypt for passwords.