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 support37123411248
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support5353 ?3437 ?6.0

See also

Document Tags and Contributors

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