6 min read
Building a Chrome extension is more approachable than most developers expect. The entire thing is HTML, CSS, and JavaScript, and Chrome handles the hard parts. This tutorial walks you through a working extension from an empty folder to something you can actually use.
What a Chrome extension actually is
A Chrome extension is a small web app that Chrome loads alongside the browser. It can modify pages, intercept requests, add a toolbar button, or run scripts in the background. Every extension is a folder of files, and Chrome reads the rules from a single JSON file called manifest.json. That is the entry point for everything.
From the studio
We build apps people actually keep.Tinkrd is a small indie studio making focused, high-quality apps for everyday life. See what we're working on.
View our appsIf you want a wider picture of the ecosystem before writing any code, the full guide to Chrome extension development covers architecture, tooling, and what the build process looks like at a larger scale.
Setting up your manifest file
The manifest file tells Chrome what your extension is, what permissions it needs, and which files to load. Manifest V3 is the current required version. Chrome Web Store stopped accepting Manifest V2 extensions, so use V3 from the start.
Here is a minimal working manifest:
{
"manifest_version": 3,
"name": "My Extension",
"version": "1.0",
"description": "Does something useful.",
"permissions": ["activeTab", "storage"],
"action": {
"default_popup": "popup.html",
"default_icon": "icon.png"
},
"content_scripts": [
{
"matches": [""],
"js": ["content.js"]
}
]
}
Keep permissions as narrow as possible. Requesting activeTab instead of tabs limits access to the current tab only, which is both safer for users and easier to get approved in the store.
Content scripts, popups, and background workers
Chrome extensions have three main places where code runs, and understanding which is which saves a lot of confusion.
Content scripts
A content script runs inside the web page the user is viewing. It can read and modify the DOM. It cannot directly call most Chrome APIs. Write your DOM manipulation here.
// content.js
document.querySelectorAll('img').forEach(img => {
img.style.border = '2px solid red';
});
Popup
The popup is a small HTML page that opens when the user clicks the toolbar icon. It has full access to Chrome APIs. Think of it as the control panel. It closes the moment the user clicks away, so do not store state here.
Service worker (background)
In Manifest V3, the background page is replaced by a service worker. It runs when needed and stops when idle. Use it for tasks like listening to browser events or managing alarms. It cannot access the DOM.
// background.js (service_worker)
chrome.runtime.onInstalled.addListener(() => {
console.log('Extension installed.');
});
Passing messages between parts
Content scripts and the popup cannot share variables directly. They communicate through Chrome’s messaging API. This is one of the first things that trips people up.
// popup.js: send a message to the content script
chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {
chrome.tabs.sendMessage(tabs[0].id, {action: 'highlight'});
});
// content.js: listen for the message
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === 'highlight') {
document.body.style.background = 'yellow';
}
});
Keep messages small and typed. A string for action and a payload object is a pattern that scales cleanly. If your extension grows, this becomes the contract between its parts.
Loading and testing your extension locally
You do not need to publish anything to test. Chrome loads unpacked extensions directly from your filesystem.
- Open Chrome and go to
chrome://extensions - Enable Developer mode using the toggle in the top right
- Click Load unpacked and select your project folder
- Your extension appears in the toolbar immediately
Every time you change a file, click the refresh icon on the extension card. Content script changes also require you to reload the target tab. Chrome DevTools works normally for popup and content script debugging. Right-click the popup and choose Inspect to open a dedicated DevTools panel.
We do this at Tinkrd for any browser tooling we build internally. Unpacked loading is fast and the feedback loop is tight.
Publishing to the Chrome Web Store
Publishing requires a one-time $5 developer registration fee and a Chrome Web Store developer account. The review process usually takes a few days for new extensions, longer if you request sensitive permissions.
Here is what you need before submitting:
| Asset | Requirement |
|---|---|
| Extension ZIP | Your project folder, zipped, no node_modules |
| Icon | 128×128 PNG |
| Screenshots | At least 1, ideally 3-5, 1280×800 or 640×400 |
| Privacy policy | Required if you collect any user data |
| Description | Plain text, up to 132 chars for the short version |
Rejections are almost always about permission justification. If you request a broad permission like tabs, write a clear single-purpose justification in the store listing. Reviewers check this carefully.
For a more detailed walkthrough of the full publish flow, the guide on how to build and publish a Chrome extension covers each step of the submission process.
Frequently asked questions
Do I need to know a framework like React to build a Chrome extension?
No. Vanilla HTML, CSS, and JavaScript are enough for most extensions. Frameworks like React can help if your popup UI is complex, but they add build tooling overhead that is rarely worth it for a simple first extension. Start plain and add complexity only when you feel the pain of not having it.
How long does Chrome Web Store review take?
Most new extensions are reviewed within two to three business days. Extensions that request sensitive permissions like webRequest or host permissions for all URLs often take longer. Updates to existing extensions are usually faster than initial submissions.
Can I make money from a Chrome extension?
Yes. The most common models are a one-time purchase, a subscription managed through your own server, or a freemium model with a paid upgrade. The Chrome Web Store itself does not handle payments well, so most developers use Stripe or Paddle and verify licenses via a backend API call from the extension.
What is the difference between Manifest V2 and Manifest V3?
Manifest V3 replaces background pages with service workers, restricts the webRequest API in favor of declarativeNetRequest, and tightens content security policies. Chrome has phased out V2 support for new submissions. Write V3 from the start and you will not need to migrate later.
Why does my content script work on some pages but not others?
Content scripts do not run on Chrome system pages like chrome:// URLs, the new tab page, or the Web Store itself. They also will not run on a page that loaded before you installed the extension. Reload the tab after installing and check your matches pattern in the manifest.
A Chrome extension tutorial can only take you so far on a page. The real learning happens when you open a text editor, build the manifest, and break something. The concepts are small, the feedback loop is fast, and the gap between idea and working prototype is shorter here than almost anywhere else in software.
We’re building in the open
Tinkrd is a small studio making thoughtful apps for families. Our first app is launching soon.