How to change chrome packaged app id Or Why do we need key field in the manifest.json? How to change chrome packaged app id Or Why do we need key field in the manifest.json? google-chrome google-chrome

How to change chrome packaged app id Or Why do we need key field in the manifest.json?


Once uploaded to the Chrome Web Store, your extension ID is fixed and cannot be changed any more.

The ID is derived from the .pem file that was created the first time you (or the Chrome Web Store) packed the extension in a .crx file. When you load an extension in "unpacked mode", an ID is automatically generated in an unpredictable way. The only way to control the extension ID during development is by setting the "key" field in the manifest file, as the documentation suggests.

When you have already published the extension in the Chrome Web Store, then you can easily get the value of this "key" field using the Chrome Extension Source Viewer. After installing the extension, go to your Chrome web store details page and click on the CRX button to view the source. When the Chrome Extension Source viewer has loaded the extension, it will display the key in the console, which can directly be copy-pasted to your manifest.json:

Screenshot: Public key (paste into manifest.json to preserve extension ID) crxviewer.js:528 "key": "....", crxviewer.js:529 Calculated extension ID: jifpbeccnghkjeaalbbjmodiffmgedin

If you have not published your extension, or you do not want to use the Chrome Web Store, then you need to generate a private key first.

  1. Go to chrome://extensions/ and enable Developer mode.
  2. Click on "Pack extension...", select your app/extension's directory and confirm.
    Now you've got a .crx file and a .pem file. Back up the private key (.pem file)!
  3. The extension mentioned can be used to get the same information. Alternatively, visit the online demo at https://robwu.nl/crxviewer/ and select the crx file you've just created (again: just open the console to see the "key" and extension ID).

When you're ready to submit your app/extension to the Chrome Web Store, follow the following steps:

  1. Create a zip file containing your extension (important: manifest.json must be at the root, i.e. "directory/manifest.json" is bad, "manifest.json" is good).
    • Add the .pem file as key.pem!
      (this is necessary to preserve the extension ID)
  2. Upload the extension to the Chrome Web Store (without the "key" field in manifest.json, the CWS will reject any upload that contains a "key" field).

For subsequent updates, "key.pem" should not be added to the zip file, because the Chrome Web Store does not need it any more.


Hopefully somebody can give a better answer than me. An app's id is generated by google when you first upload it to the web store. However, it's not the same id that you have when developing locally. Your chrome browser generated some other id using some other mechanism.

When you are developing locally from your source code directory as an unpacked extension, and you want to use the id that the chrome web store assigned to your app, you put the "key" in your manifest and reload your app. This helps you because many APIs expect chrome.runtime.id (the id of your app) to be the same value as the app in the store. You can leave the "key" in your manifest and it will be ignored.


For anyone having problem loading the unpacked extension with the key field in the manifest.json file.

Remove your published extension if you have it in your extension list but disabled. Since otherwise your local dev extension won't load and no error will be shown. The reason being that chrome detects duplicate keys for the extension and ignores it silently.