Sets the badge text for the browser action. The badge is displayed on top of the icon.

Tabs without an specific badge text will inherit the global badge text, which is "" by default.


  details // object

This API is also available as chrome.browserAction.setBadgeText().



string or null. Any number of characters can be passed, but only about four can fit in the space.

Use an empty string - "" - if you don't want any badge.

If a tabId is specified, null removes the tab-specific badge text so that the tab inherits the global badge text. Otherwise it reverts the global badge text to "".

integer. Set the badge text only for the given tab. The text is reset when the user navigates this tab to a new page. If this argument is omitted, the global badge text is set instead.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
Basic support Yes14451 No Yes
The text property of the details parameter can be set to null. No No59 No No

1. On Firefox, the badge text is not cleared on navigation, see bug 1395074.


Add a badge indicating how many times the user clicked the button:

var clicks = 0;

function increment() {
  browser.browserAction.setBadgeText({text: (++clicks).toString()});


Example extensions


This API is based on Chromium's chrome.browserAction API. This documentation is derived from browser_action.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

Last updated by: wbamberg,