This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is available in Web Workers.
The Crypto interface represents basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives.
The Crypto is available in windows using the Window.crypto property and in workers using the WorkerGlobalScope.crypto property.
This interface implements properties defined on RandomSource.
Crypto.subtle Read only Secure context
Returns a SubtleCrypto object providing access to common cryptographic primitives, like hashing, signing, encryption, or decryption.
This interface implements methods defined on RandomSource.
Crypto.getRandomValues()Fills the passed TypedArray with cryptographically sound random values.
Crypto.randomUUID() Secure context
Returns a randomly generated, 36 character long v4 UUID.
| Specification |
|---|
| Web Cryptography Level 2> # crypto-interface> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
Crypto |
11 | 12 | 21 | 15 | 5 | 18 | 21 | 14 | 5 | 1.0 | 4.4 | 5 |
getRandomValues |
11 | 12 | 21 | 15 | 5 | 18 | 21 | 14 | 5 | 1.0 | 4.4 | 5 |
randomUUID |
92 | 92 | 95 | 78 | 15.4 | 92 | 95 | 65 | 15.4 | 16.0 | 92 | 15.4 |
subtle |
37 | 12 | 34 | 24 | 117–11.1 | 37 | 34 | 24 | 117–11.3 | 3.0 | 37 | 117–11.3 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Crypto