How to Build Your First Chrome Extension: A Step-by-Step Guide for Beginners

Author

Kritim Yantra

Jun 14, 2025

How to Build Your First Chrome Extension: A Step-by-Step Guide for Beginners

πŸš€ Ever wanted to build a Chrome extension but thought it was too hard? Think again! In under 30 minutes, you can create a custom extension that modifies websites, blocks distractions, or even replaces all images with cats.

In this guide, you’ll learn:

βœ… What makes Chrome extensions so powerful (and easy!)
βœ… The 3 essential files every extension needs
βœ… How to build a real extension from scratch
βœ… How to publish it to the Chrome Web Store (optional)

No prior extension experience neededβ€”just basic HTML, CSS, and JavaScript. Let’s dive in!


Why Build a Chrome Extension?

🌟 The Power of Extensions

  • Automate repetitive tasks (e.g., auto-fill forms, highlight keywords)
  • Modify websites (e.g., dark mode for any site)
  • Integrate with APIs (e.g., ChatGPT summarizer for articles)

πŸ›  Why It’s Easier Than You Think

Extensions are just HTML, CSS, and JS wrapped in a special folder. If you can build a website, you can build an extension!


What You Need to Get Started

πŸ“ File Structure of Every Chrome Extension

All extensions require:

  1. manifest.json – The "settings" file (like package.json for Node.js).
  2. popup.html (optional) – The UI when you click the extension icon.
  3. background.js (optional) – Runs code in the background.
  4. content.js (optional) – Modifies web pages directly.
my-extension/  
β”œβ”€β”€ manifest.json  
β”œβ”€β”€ popup.html  
β”œβ”€β”€ popup.css  
β”œβ”€β”€ popup.js  
└── icons/  
    β”œβ”€β”€ icon16.png  
    β”œβ”€β”€ icon48.png  
    └── icon128.png  

Step 1: Create the Manifest File (manifest.json)

This file tells Chrome:

  • What your extension does
  • What permissions it needs
  • Which files to load
{
  "manifest_version": 3,
  "name": "My First Extension",
  "version": "1.0",
  "description": "A simple Chrome extension demo!",
  "icons": {
    "16": "icons/icon16.png",
    "48": "icons/icon48.png",
    "128": "icons/icon128.png"
  },
  "action": {
    "default_popup": "popup.html"
  },
  "permissions": ["activeTab"]
}

πŸ”Ή Key Fields:

  • manifest_version: Always 3 (newest standard).
  • action: Defines what happens when you click the extension icon.
  • permissions: Requests access to browser features (e.g., "storage", "tabs").

Step 2: Build the Popup UI (popup.html)

This is the small window that appears when you click your extension’s icon.

<!DOCTYPE html>
<html>
<head>
  <title>My Extension</title>
  <link rel="stylesheet" href="popup.css">
</head>
<body>
  <h1>Hello, World! 🌎</h1>
  <button id="changeTextBtn">Click Me</button>
  <script src="popup.js"></script>
</body>
</html>

Style it with popup.css:

body {
  width: 200px;
  padding: 10px;
  text-align: center;
  font-family: Arial, sans-serif;
}

button {
  background: #4285F4;
  color: white;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
}

Step 3: Add Interactivity (popup.js)

Let’s make the button change the text when clicked.

document.getElementById("changeTextBtn").addEventListener("click", () => {
  document.querySelector("h1").textContent = "Button Clicked! πŸŽ‰";
});

Step 4: Load Your Extension in Chrome

  1. Go to chrome://extensions in Chrome.
  2. Enable Developer mode (toggle in top-right).
  3. Click Load unpacked and select your extension folder.

πŸŽ‰ Your extension is now live! Click its icon to see the popup.


Going Further: Modify Web Pages (content.js)

Want to change websites dynamically? Use a content script.

  1. Update manifest.json:
{
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["content.js"]
    }
  ]
}
  1. Create content.js:
// Replace all paragraphs with "Hello, Extension!"
document.querySelectorAll("p").forEach(p => {
  p.textContent = "Hello, Extension!";
});

Reload your extension and visit any pageβ€”you’ll see the magic!


Publishing to the Chrome Web Store (Optional)

  1. Zip your extension folder.
  2. Go to the Chrome Developer Dashboard.
  3. Upload, pay the $5 fee, and submit for review.

Key Takeaways

βœ” Chrome extensions = HTML/CSS/JS + manifest.json
βœ” popup.html = UI when clicking the icon
βœ” content.js = Modify web pages directly
βœ” Test locally first, then publish if needed


Your Turn: Build an Extension Today!

πŸ’‘ Try these fun ideas:

  • Dark Mode For Any Site (inject CSS)
  • Auto-Translate Page (using Google Translate API)
  • Meme Replacer (swap all images with memes)

πŸ”— Resources:

What will you build? Share your ideas below! πŸš€

LIVE MENTORSHIP ONLY 5 SPOTS

Laravel Mastery
Coaching Class Program

KritiMyantra

Transform from beginner to Laravel expert with our personalized Coaching Class starting June 21, 2025. Limited enrollment ensures focused attention.

Daily Sessions

1-hour personalized coaching

Real Projects

Build portfolio applications

Best Practices

Industry-standard techniques

Career Support

Interview prep & job guidance

Total Investment
$200
Duration
30 hours
1h/day

Enrollment Closes In

Days
Hours
Minutes
Seconds
Spots Available 5 of 10 remaining
Next cohort starts:
June 21, 2025

Join the Program

Complete your application to secure your spot

Application Submitted!

Thank you for your interest in our Laravel mentorship program. We'll contact you within 24 hours with next steps.

What happens next?

  • Confirmation email with program details
  • WhatsApp message from our team
  • Onboarding call to discuss your goals

Comments

No comments yet. Be the first to comment!

Please log in to post a comment:

Sign in with Google

Related Posts

Advanced Flask Interview Questions and Answers
Kritim Yantra Kritim Yantra
Feb 24, 2025
Laravel 12 Unleashed: Early Insights & What Lies Ahead
Kritim Yantra Kritim Yantra
Feb 24, 2025
Getting Started with Laravel Starter Kits: Build Apps Faster
Kritim Yantra Kritim Yantra
Feb 24, 2025