The SubtleCrypto.exportKey() method returns a Promise of the key encrypted in the requested format. If the key is not extractable, that is if CryptoKey.extractable returns false, the promise fails with an InvalidAccessError exception; it the format is unknown, the promive fails with a NotSupported exception.


var result = crypto.subtle.exportKey(format, key);


  • format is an enumerated value describing the data format in which the key has to be exported. It can be one of the following:
  • key is the CryptoKey to export.

Return value

  • result is a Promise that returns the key in the requested format.


The promise is rejected when one of the following exceptions is encountered:


Specification Status Comment
Web Cryptography API
The definition of 'SubtleCrypto.exportKey()' in that specification.
Recommendation Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support3712


32 — 341

FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support373712


32 — 341


1. From version 32 until version 34 (exclusive): this feature is behind the dom.webcrypto.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.

2. Returns KeyOperation instead of Promise

See also

Document Tags and Contributors

Contributors to this page: fscholz, fozi, Dans24, abbycar, teoli
Last updated by: fscholz,