Encodera

Thanks for reading!

Donate to the site — we work hard for you.

Contents

Browserslist: the list of browsers

Browserslist is a shared way for many tools to record which browsers a site must support. Autoprefixer, postcss-preset-env, Babel and others read it. You describe the list once, and plugins decide by themselves whether prefixes and replacements for new CSS features are needed.

Where the list goes

Add a browserslist key to the blog project's package.json:

{
  "browserslist": ["defaults"]
}

The defaults query is the recommended choice: browsers with more than 0.5% share, the last two versions of each, and Firefox ESR, excluding "dead" ones (no updates for two years). If there is no list at all, plugins use defaults too.

Instead of the key in package.json you can create a .browserslistrc file in the project root — one query per line:

# .browserslistrc
defaults

Use only one of them: if both exist, Browserslist reports an error.

Checking the list

npx browserslist shows what the query turned into:

npx browserslist
and_chr 154
and_ff 157
and_qq 14.9
and_uc 15.5
android 154
chrome 154
chrome 153
chrome 151
...

Each line is a browser and a version. The --coverage flag shows what share of users the list covers:

npx browserslist --coverage "defaults"
These browsers account for 84.65% of all users globally

The numbers depend on how fresh the data is: here and later in the course the results were produced in October 2026.

Common queries

QueryMeaning
defaultsA sensible default set
> 1%Browsers with more than 1% share
last 2 versionsThe last two versions of each browser
not deadExclude browsers with no updates for two years
baseline widely availableBrowsers that have every Baseline Widely Available feature
safari >= 15Safari 15 and newer
not op_mini allExclude Opera Mini

Queries separated by commas are combined, while and and not narrow the list:

{
  "browserslist": ["defaults", "not op_mini all"]
}

Updating the data

Browser data lives in the caniuse-lite package inside node_modules. Update it every few months:

npx update-browserslist-db@latest

When the data is more than six months old, plugins print a reminder such as Browserslist: browsers data (caniuse-lite) is 7 months old. Please run: npx update-browserslist-db@latest.

Common mistake

Starting the list with not dead. A not query only subtracts browsers from those already selected, so this list is empty — Browserslist stops with a message that starts with Write any browsers query. First say which browsers to include, for example defaults, then the exclusions.

Thanks for reading!

Donate to the site — we work hard for you.