© 2026 WriterDock.

Coding

How to Make a Chrome Extension: Beginner’s Guide

Suraj - Writer Dock

Suraj - Writer Dock

March 8, 2026

How to Make a Chrome Extension: Beginner’s Guide

Have you ever found yourself doing the same repetitive task in your web browser and thought there must be a better way? Custom browser tools are the solution to automating those tedious workflows. They allow you to modify how websites look, operate, and interact with your daily tasks.

If you already know the basics of web development, you possess all the skills needed to build one today. Creating an extension is not as intimidating as it sounds. It does not require learning a completely new programming language or downloading heavy desktop software.

Building a custom extension is also an incredible way to provide immediate value to your audience. If you manage a blogging website or a digital content platform, offering a free browser tool can drive massive traffic to your primary site. Furthermore, having a published extension is a fantastic way to elevate your professional portfolio and stand out on career networking platforms.

This guide will walk you through the entire process from scratch. We will cover the core architecture, write the actual code for a functional project, and show you how to test it directly in your browser.

What Exactly is a Chrome Extension?

At its core, a Chrome extension is simply a small website that lives inside your browser. It is built using the exact same technologies that power the rest of the internet: HTML, CSS, and JavaScript.

Instead of being hosted on a remote server and accessed via a URL, the files are bundled together and installed locally on your machine. The browser then grants this bundle special permissions to interact with the web pages you visit.

Because they use standard web languages, extensions are incredibly versatile. You can build anything from a simple color picker to a complex productivity dashboard that syncs with an external database.

The Core Components of an Extension

Before we start writing code, you need to understand how the different pieces of an extension talk to each other. An extension is typically made up of four main building blocks.

The Manifest File

Every extension must have a file named manifest.json located in its root directory. This is the instruction manual for the browser. It tells Chrome the name of your extension, what permissions it needs, and where to find the other necessary files.

The Popup User Interface

When you click an extension icon next to your address bar, a small window usually drops down. This is the popup. It is simply an HTML file styled with CSS. This serves as the primary user interface where people will interact with your tool.

Content Scripts

Content scripts are JavaScript files that are injected directly into the web pages you visit. They can read the details of the page, make changes to the layout, and extract information. If you want to build a tool that highlights specific words on a blog, you will use a content script.

Background Service Workers

Sometimes your extension needs to run tasks behind the scenes, even when the popup is closed. Service workers handle these background events. They can listen for browser updates, manage network requests, or trigger alarms at specific times.

Step-by-Step Tutorial: Building an Article Word Counter

To put theory into practice, we are going to build a practical tool. We will create a "Word Counter" extension.

This tool is highly useful for writers, editors, and anyone running a blogging website who needs to quickly check the length of an article they are reading. When the user clicks the extension icon, it will calculate the total number of words on the current page and display the result.

Step 1: Set Up Your Project Folder

First, create a brand new folder on your computer and name it something recognizable, like word-counter-extension. All the files we write will be saved directly into this single folder. You can open this folder in your preferred code editor.

Step 2: Write the Manifest File

Create a new file in your folder and name it manifest.json. This file requires strict formatting. We will be using Manifest V3, which is the current and most secure standard required by Google.

Add the following code to your file:

json
1{
2  "manifest_version": 3,
3  "name": "Article Word Counter",
4  "version": "1.0",
5  "description": "Counts the total number of words on the current web page.",
6  "action": {
7    "default_popup": "popup.html"
8  },
9  "permissions": [
10    "activeTab",
11    "scripting"
12  ]
13}

This code tells the browser the basic details of your tool. The permissions array is crucial here. We are asking for permission to access the currently active tab and the ability to execute a script on that specific tab.

Step 3: Design the Popup Interface

Next, we need to create the visual window that appears when a user clicks the extension icon. Create a new file named popup.html in the same folder.

Add this basic HTML structure:

html
1<!DOCTYPE html>
2<html>
3<head>
4  <style>
5    body {
6      width: 250px;
7      padding: 15px;
8      font-family: Arial, sans-serif;
9      text-align: center;
10    }
11    button {
12      background-color: #007bff;
13      color: white;
14      border: none;
15      padding: 10px 15px;
16      cursor: pointer;
17      border-radius: 5px;
18      font-size: 14px;
19    }
20    button:hover {
21      background-color: #0056b3;
22    }
23    #result {
24      margin-top: 15px;
25      font-size: 18px;
26      font-weight: bold;
27      color: #333;
28    }
29  </style>
30</head>
31<body>
32  <h2>Word Counter</h2>
33  <button id="countBtn">Count Words</button>
34  <div id="result"></div>
35  <script src="popup.js"></script>
36</body>
37</html>

This code creates a clean, minimal interface with a single button and a designated area to display the final word count. Notice the <script> tag at the very bottom; this links our interface to the logic file we will build next.

Step 4: Add the JavaScript Logic

Now it is time to make the button actually do something. Create a third file in your folder and name it popup.js.

This script needs to listen for a button click, ask Chrome which tab is currently active, and then inject a tiny piece of code into that tab to count the text.

Add the following JavaScript:

javascript
1document.getElementById('countBtn').addEventListener('click', async () => {
2  // Find the currently active tab in the current window
3  let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
4
5  // Execute the counting function on that tab
6  chrome.scripting.executeScript({
7    target: { tabId: tab.id },
8    function: countWordsOnPage,
9  }, (results) => {
10    // Display the result returned from the injected script
11    document.getElementById('result').innerText = results[0].result + " words found.";
12  });
13});
14
15// This function runs entirely inside the context of the web page
16function countWordsOnPage() {
17  const text = document.body.innerText || "";
18  const words = text.match(/\b[-?(\w+)?]+\b/gi);
19  return words ? words.length : 0;
20}

When the button is clicked, the chrome.scripting API takes the countWordsOnPage function and forces the live website to run it. The function strips all the text from the body of the website, uses a regular expression to count the words, and sends the final number back to your popup window.

How to Test Your Extension Locally

You now have a complete, functional browser extension. You do not need to upload it to the internet to test it. You can load it directly from your computer using developer tools.

Open your Chrome browser and type chrome://extensions into the address bar. Press enter to access your extensions management dashboard.

Look at the top right corner of the screen for a toggle switch labeled "Developer mode." Turn this switch on. This reveals a new menu bar with advanced options.

Click the button that says "Load unpacked." A file browser window will appear. Navigate to the folder you created earlier (word-counter-extension), select the entire folder, and click open.

Your new extension will instantly appear in your dashboard. You can now click the puzzle piece icon next to your address bar, pin your new tool, and test it out on any web page.

Scaling Up: Full-Stack Architecture

The example we built is entirely self-contained within the browser. However, the true power of extensions unlocks when you connect them to external systems.

If you are comfortable working with modern web stacks, you can turn a simple browser tool into a highly profitable software application. An extension can act as a lightweight frontend client that communicates with a powerful backend server.

You can use the built-in fetch API inside your extension to send data to an external server. For instance, you could build a custom Node.js and Express backend to process complex requests that would otherwise freeze the user's browser.

This architecture allows you to connect your browser tool directly to a NoSQL database. You can save user preferences, synchronize data across multiple computers, and implement secure user authentication. Building a full-stack extension is a brilliant way to showcase comprehensive engineering skills.

Publishing Your Work

Once your project is polished and bug-free, you might want to share it with the world. Publishing an extension requires registering as a developer on the official Chrome Web Store.

Google charges a small, one-time registration fee to set up a developer account. This fee helps prevent spam on the platform. Once your account is active, you compress your project folder into a ZIP file and upload it through the developer dashboard.

You will need to provide a title, a detailed description, and a few promotional screenshots. Google then reviews your code to ensure it meets their security and privacy guidelines. Once approved, your tool becomes available for millions of users to download and install.

Frequently Asked Questions (FAQ)

Can I use modern frameworks like React or Angular to build an extension?

Absolutely. While our tutorial used plain HTML and JavaScript for simplicity, you can use any modern frontend framework. You will simply need to configure your build tools, like Webpack or Vite, to output the compiled files in a structure that the browser’s manifest file expects.

Do I have to pay every time I upload an update to my extension?

No. The developer registration fee is a one-time charge. Once your account is created, you can publish multiple extensions and push as many updates to your existing projects as you want without any additional costs.

How long does the review process take when publishing?

The review time varies depending on the complexity of your code and the permissions you requested. Simple extensions that only ask for basic permissions are often approved within twenty-four to forty-eight hours. Complex tools that require deep access to user data may take several days or even weeks for a manual security review.

Why is my content script not running on certain pages?

Browsers restrict extensions from running on highly sensitive pages for security reasons. Your scripts will not execute on internal browser settings pages, the new tab page, or the Chrome Web Store itself. Ensure you are testing your tool on a standard, public website.

Final Thoughts on Building Extensions

Creating a custom browser extension is one of the most rewarding coding projects you can undertake. It requires very little setup time, uses standard web languages you likely already know, and provides an immediate, tangible result that you can use every day.

Whether you are looking to automate a tedious task, build a companion tool for your content platform, or design a fully-fledged software product, the browser is an incredible canvas. Start small, experiment with different APIs, and gradually add complexity as you become more comfortable with the architecture.

The internet is full of repetitive workflows waiting to be optimized. By mastering extension development, you gain the power to reshape the browsing experience exactly how you want it.

About the Author

Suraj - Writer Dock

Suraj - Writer Dock

Passionate writer and developer sharing insights on the latest tech trends. loves building clean, accessible web applications.