How to Write and Create a Basic Chrome Extension

2025-11-14

Chrome is easily the most popular web browser on the planet. According to Statcounter’s desktop browser market share survey, Chrome takes home a whopping 65% of the market in desktop browsers as of late 2017.

With that sort of market-defining power, designing for Chrome has become a priority. The same goes for extensions: Chrome offers the largest user base for extensions by far, with tens of thousands of extensions, themes and apps populating the Chrome Web Store.

If you want to cash in on the trend, you can build your own basic Chrome extension. You’ll just need some basic web development skills (HTML, CSS and Javascript) as well as a teaspoonful of JSON to tie it all together.

We’ll be reviewing the most basic structure required to build a basic Chrome extension in this post. To get an in-depth view of the possibilities available, check out Chrome’s Developer Extension Guide.

Writing a Basic Chrome Extension: Manifest Destiny

For this tutorial we will build a basic Chrome extension that displays a simple popup message when clicked. We’ll need a couple of important files: an icon (“icon.png”), an HTML file (“popup.html”) and the all-important manifest (“manifest.json”). All these files will live inside of a directory with the name of your extension. In this case that’s called “Hello World.”

build-a-chrome-extension-hello-world-files

A Chrome extension is defined by its manifest. This snippet of JSON shows Chrome how to interpret the extension, what files to load, and how to interact with the user.

The manifest file for our very basic extension looks like this:

{
    "manifest_version": 2,

    "name": "Hello World!",
    "description": "My first Chrome extension.",
    "browser_action": {
        "default_icon": "icon.png",
        "default_popup": "popup.html"
    },
    "permissions": [
        "activeTab"
     ]
}

This manifest file will put an icon in the user’s toolbar that, when clicked, loads the contents of the file named “popup.html.” The following is the nitty-gritty on the rest of the contents:

  • manifest_version tells Chrome what version of the manifest markup you’re working with. For modern extensions, you’ll need to set this to 2.
  • name displays the name the extension will show in Chrome store and “chrome://extensions.”
  • description shows the descriptive text displayed on “chrome://extensions.”
  • browser action loads the icon into the toolbar. It also allows the extension to respond to user input by displaying a tooltip, popup or badge. Check out a full list of everything “browser_action” can do.
  • default_icon shows the path to the icon from the extension’s directory.
  • default_popup shows the path to the file that will load when the extension’s icon is clicked.
  • permissions limits the extension’s functional region. activeTab is the most common, allowing the extension to access the front-most tab. Google provides a list of all the permissions an extension can request.

If you want a deep dive into everything that a Chrome extension’s manifest can declare, check out Google’s docs on extension manifests.

Writing a Basic Chrome Extension: Popups

Now that we’ve written our manifest, we can figure out what our extension will display. That’s up to our “popup.html” file, which will display when the extension loads. Here’s what we’ll be using for this project:

<!doctype html>
<html>
    <head>
        <title>Hello World</title>
    </head>
    <style type="text/css">
        body {
            margin: 5px;
        }
        h1 {
            font-size: 15px;
            text-align: center;
        }
    </style>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>

As you can see, this will render some text styled with CSS. If you want to add Javascript or external CSS to your extension, that requires declaring the scripts in the manifest, under the content_scripts key. Once you have that referenced in the manifest, you can load those scripts as you normally would.

Writing a Basic Chrome Extension: Loading into Chrome

Once we’ve written the basic code for our extension and found a suitable icon, we can load it into Chrome.

1. Navigate to “chrome://extensions” and turn on “Developer Mode” by ticking the checkbox in the upper-right.

build-a-chrome-extension-load-extension-1

2. Click the “Load unpacked extension…” button and select the extension’s directory.

build-a-chrome-extension-load-extension-2

3. Once the extension is loaded, you’ll see its icon in the menu bar.

build-a-chrome-extension-load-extension-3

4. Click on the extension to see its (very simple) effect.

build-a-chrome-extension-load-extension-4

Conclusion: Expanding Your Chrome Extension

Once you’re finished with your extension and are ready to publish, you’ll need to create a Chrome developer account. That’s not an exactly straightforward process, but Google provides complete instructions for publishing your Chrome extension here.

There is obviously so much more you can do with your Chrome extension, but that’s somewhat beyond the scope of this post. If you want to learn more about everything Chrome extensions can do, check out Google’s Chrome Developer Extension Guide.

Comments on " How to Write and Create a Basic Chrome Extension" :

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Related Article

    How to Connect MailChimp to Your WordPress Site
    INTERNET

    How to Connect MailChimp to Your WordPress Site

    When you are running a website or blog, one of the important things you need to do is build an email

    What Is a WebP Image and How Can You Save It?
    INTERNET

    What Is a WebP Image and How Can You Save It?

    Over the past few years Google has quietly unveiled a new image format called “WebP.” The WebP f

    How Does MoviePass Work, and Is It Worth It?
    INTERNET

    How Does MoviePass Work, and Is It Worth It?

    If you’re a movie fan who loves to go to the movies, you’ve probably heard of MoviePass. The New

    Top 10 Free Image Hosting Services You Should Try for Hosting Your Photos
    INTERNET

    Top 10 Free Image Hosting Services You Should Try for Hosting Your Photos

    When you have many images you want to share on social media or use elsewhere online, one of your bes

    Should Facebook Let Users Define Fake News?
    INTERNET

    Should Facebook Let Users Define Fake News?

    Mark Zuckerberg has long taken it upon himself to make an enemy of “fake news”. Aside from the f

    5 of The Best WordPress Plugins to Integrate Bitcoins to Your Site
    INTERNET

    5 of The Best WordPress Plugins to Integrate Bitcoins to Your Site

    If Bitcoin and WordPress are two of your passions, this article will show how you can merge them –

    Use the Facebook Container Extension to Prevent Facebook from Tracking You
    INTERNET

    Use the Facebook Container Extension to Prevent Facebook from Tracking You

    “If you’re not the customer, you’re the product.” If you’re a Facebook user (or a user of

    What Would An “Unsend” Feature in Messenger Do to Facebook?
    INTERNET

    What Would An “Unsend” Feature in Messenger Do to Facebook?

    Have you ever sent a message in the heat of the moment that you’d like to take back before the per

    About Netverse

    We are a premier digital platform committed to delivering high-quality content to our readers. Our mission is to provide accurate, reliable, and engaging information that adds value to our audience's daily lives.

    Our team consists of experienced content creators and subject matter experts who uphold the highest standards of professionalism. In an era of information overload, we curate content with care, ensuring our users receive only the most relevant and trustworthy information.

    Beyond just reporting facts, we focus on depth and context. Through expert analysis, comprehensive research, and clear presentation, we help our audience gain meaningful insights and make informed decisions.

    We take pride in being a trusted information source for our growing community of readers. Our user-first approach means we continuously adapt to provide content that meets our audience's evolving needs and interests.

    Innovation and excellence drive everything we do. We're committed to improving our platform and services to deliver the best possible experience for our users.