Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
11
12
21
5
18
5

The crypto read-only property of the Window interface returns the Crypto object for this window's scope. This object gives web pages access to certain cryptographic related services.

37
12
1
5
37
5

The Crypto.getRandomValues() method lets you get cryptographically strong random values. The array given as the parameter is filled with random numbers (random in its cryptographic meaning).

11
12
21
5
18
5

The randomUUID() method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.

92
92
95
15.4
92
15.4

The Crypto.subtle read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.

37
12
34
11
37
11
subtle (secure context required)

Secure context required

60
79
75
15
60
15
worker_support

Available in workers

37
79
48
10.1
37
10.3

The CryptoKey interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.

37
12
34
7
37
7

The read-only algorithm property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.

37
12
34
7
37
7

The read-only extractable property of the CryptoKey interface indicates whether or not the key may be extracted using SubtleCrypto.exportKey() or SubtleCrypto.wrapKey().

37
12
34
7
37
7

The read-only type property of the CryptoKey interface indicates which kind of key is represented by the object. It can have the following values:

37
12
34
7
37
7

The read-only usages property of the CryptoKey interface indicates what can be done with the key.

37
12
34
7
37
7

The SubtleCrypto interface of the Web Crypto API provides a number of low-level cryptographic functions.

37
12
34
11
37
11

The decrypt() method of the SubtleCrypto interface decrypts some encrypted data. It takes as arguments a key to decrypt with, some optional extra parameters, and the data to decrypt (also known as "ciphertext"). It returns a Promise which will be fulfilled with the decrypted data (also known as "plaintext").

37
79
34
7
37
7

The deriveBits() method of the SubtleCrypto interface can be used to derive an array of bits from a base key.

41
79
34
11
41
11
deriveBits (x25519)

`X25519` algorithm

133
133
130
17
133
17

The deriveKey() method of the SubtleCrypto interface can be used to derive a secret key from a master key.

41
79
34
11
41
11
deriveKey (derivedKeyAlgorithm option aes)

`AES` as `derivedKeyAlgorithm` option value

41
79
34
11
41
11
deriveKey (derivedKeyAlgorithm option hkdf)

`HKDF` as `derivedKeyAlgorithm` option value

41
79
119
11
41
11
deriveKey (derivedKeyAlgorithm option hmac)

`HMAC` as `derivedKeyAlgorithm` option value

41
79
34
11
41
11
deriveKey (derivedKeyAlgorithm option pbkdf2)

`PBKDF2` as `derivedKeyAlgorithm` option value

41
79
119
11
41
11
deriveKey (x25519)

`X25519` algorithm

133
133
130
17
133
17

The digest() method of the SubtleCrypto interface generates a digest of the given data, using the specified hash function. A digest is a short fixed-length value derived from some variable-length input. Cryptographic digests should exhibit collision-resistance, meaning that it's hard to come up with two different inputs that have the same digest value.

41
79
34
7
41
7

The encrypt() method of the SubtleCrypto interface encrypts data.

37
79
34
7
37
7

The exportKey() method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.

37
79
34
7
37
7
exportKey (ed25519)

`Ed25519` algorithm

137
137
129
17
137
17
exportKey (x25519)

`X25519` algorithm

133
133
130
17
133
17

The generateKey() method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).

37
79
34
7
37
7
generateKey (ed25519)

`Ed25519` algorithm

137
137
129
17
137
17
generateKey (x25519)

`X25519` algorithm

133
133
130
17
133
17

The importKey() method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.

37
79
34
7
37
7
importKey (ed25519)

`Ed25519` algorithm

137
137
129
17
137
17
importKey (x25519)

`X25519` algorithm

133
133
130
17
133
17
secure_context_required

Secure context required

60
79
75
15
60
15

The sign() method of the SubtleCrypto interface generates a digital signature.

37
79
34
7
37
7
sign (ed25519)

`Ed25519` algorithm

137
137
129
17
137
17

The unwrapKey() method of the SubtleCrypto interface "unwraps" a key. This means that it takes as its input a key that has been exported and then encrypted (also called "wrapped"). It decrypts the key and then imports it, returning a CryptoKey object that can be used in the Web Crypto API.

37
79
34
7
37
7

The verify() method of the SubtleCrypto interface verifies a digital signature.

37
79
34
7
37
7
verify (ed25519)

`Ed25519` algorithm

137
137
129
17
137
17
worker_support

Available in workers

37
79
48
11
37
11

The wrapKey() method of the SubtleCrypto interface "wraps" a key. This means that it exports the key in an external, portable format, then encrypts the exported key. Wrapping a key helps protect it in untrusted environments, such as inside an otherwise unprotected data store or in transmission over an unprotected network.

37
79
34
7
37
7
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (11.1)
Compatibility
  • Available with a vendor prefix: webkit (7)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (11.3)
Compatibility
  • Available with a vendor prefix: webkit (7)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (11.1)
Compatibility
  • Available with a vendor prefix: WebKit (7)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (11.3)
Compatibility
  • Available with a vendor prefix: WebKit (7)
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: AES-CTR.
Notes 4 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: ECDH.
  • Not supported: HKDF, PBKDF2.
Notes 4 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: ECDH.
  • Not supported: HKDF, PBKDF2.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (41)
Implementation note
  • Before version 41, Chrome expected the `algorithm` parameter to be an object.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: SHA-1.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (41)
Implementation note
  • Before version 41, Chrome Android expected the `algorithm` parameter to be an object.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: AES-CTR.
Notes 4 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: RSA-PSS, ECDSA, ECDH.
  • Not supported: AES-CTR.
Notes 4 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: RSA-PSS, ECDSA, ECDH.
  • Not supported: AES-CTR.
Notes 4 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: RSA-PSS, ECDSA, ECDH.
  • Not supported: AES-CTR, HKDF, PBKDF2.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: RSA-PSS, ECDSA.
Notes 1 item(s)
Implementation note
  • Generates randomized signatures as per draft-irtf-cfrg-det-sigs-with-noise, instead of deterministic signatures as per RFC 8032.
Notes 1 item(s)
Implementation note
  • Generates randomized signatures as per draft-irtf-cfrg-det-sigs-with-noise, instead of deterministic signatures as per RFC 8032.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: AES-CTR.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: RSA-PSS, ECDSA.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (79)
Implementation note
  • Not supported: AES-CTR.

Use cases

  • Using Web Cryptography

    The Crypto interface represents basic cryptography features available in the current context.

Cautions

  • May not be supported in older browsers.

Implementation notes

  • Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.