Why the Browser's Standard Hash API Doesn't Support MD5
Try calling crypto.subtle.digest('MD5', ...) directly in a browser console and you'll get an immediate NotSupportedError. SHA-256 and SHA-1 work fine, but MD5 alone fails — not because of an implementation bug, but because the browser standard itself deliberately excludes MD5 from its supported list. Here's why that choice was made, and how sites actually handle situations where an MD5 hash is genuinely needed.
1. The root reason MD5 was excluded from the standard: it was already dead
MD5 is a hash function published in 1992. Early vulnerabilities were pointed out academically starting in 1996, and by 2004-2005, research by Wang Xiaoyun and others succeeded in deliberately engineering collisions — two different inputs producing the same hash value. Since then, MD5 has effectively been treated as a retired algorithm for security integrity checks or digital signatures. The Web Crypto API was standardized by the W3C between roughly 2013 and 2017 — by which point MD5 had already been conclusively judged untrustworthy, so it was never included in the new standard to begin with.
2. The algorithms the SubtleCrypto spec actually defines
The W3C specification for crypto.subtle.digest() defines exactly four digest algorithms: SHA-1, SHA-256, SHA-384, and SHA-512. Even SHA-1 has had collision attacks demonstrated in practice (Google's 2017 SHAttered research) and isn't recommended for security purposes, but it remains in the spec for backward compatibility. MD5 was broken earlier and more severely than SHA-1, so it was never even up for discussion.
await crypto.subtle.digest(algo, data). Pass 'SHA-256' as the algo value and it works fine; pass 'MD5' and the browser throws immediately — which is why this tool excludes MD5 from its supported algorithm list entirely and only offers SHA-1/256/384/512.
3. So what do you do when you actually need MD5: a pure-JS implementation
Just because the Web Crypto API can't compute it doesn't mean MD5 is impossible to compute in a browser at all — you can implement the algorithm directly in JavaScript. In fact, this site's own Hash Generator uses crypto.subtle.digest for the SHA family, but for MD5 specifically, it implements the algorithm directly in pure JS via internal functions like md5cmn, md5ff, and md5gg. This is a classic pattern of filling a gap the browser's standard API leaves open with an application-level library implementation.
4. Standard API vs. pure-JS implementation, side by side
| Web Crypto API | Pure-JS implementation | |
|---|---|---|
| Supported algorithms | SHA-1/256/384/512 only | MD5 and virtually any algorithm |
| Execution speed | Native browser code, fast | JS interpreter, relatively slower |
| Implementation reliability | Verified by browser vendors | Depends on library code quality |
| Example on this site | hash-checker.html (SHA only) | hash-generator.html (includes self-implemented MD5) |
5. When MD5 is still fine to use, and when it isn't
- Still fine: file duplicate detection, cache-invalidation keys, non-security checksums — situations that don't assume a deliberate forgery attack.
- Not fine: password storage, digital signatures, file-integrity guarantees — any security use case where an attacker deliberately crafting different data with the same hash (a collision attack) is itself the threat you're defending against.
Where security matters, use the SHA-256 Generator; for password storage, use a dedicated key-stretching algorithm like the bcrypt Generator instead of a plain hash.
Frequently Asked Questions
Q. What exact error does crypto.subtle.digest('MD5', data) throw?
A. Wording varies by browser, but it generally throws a NotSupportedError-class exception, often along the lines of "Algorithm: Unrecognized name." This happens because you're passing an algorithm name that isn't defined in the spec.
Q. Can Node.js compute MD5?
A. Yes. Node.js's crypto module is built on OpenSSL, so independent of the browser standard (SubtleCrypto), it supports a much wider range of algorithms including MD5. The browser limitation comes specifically from the SubtleCrypto web spec itself.
Q. Will SHA-1 eventually get dropped from the spec too?
A. It's possible. SHA-1 is already not recommended for security purposes, but it remains in the current spec for legacy compatibility. Full exclusion like MD5 could still take a while.
Q. Which tool on this site should I use if I need an MD5 hash?
A. The Hash Generator provides a pure-JS MD5 implementation alongside the SHA family. The Hash Checker, by contrast, only uses the Web Crypto API, so it does not support MD5.