Looking for a Google Maps alternative that won't break the bank? Mapbox offers 50,000 free map loads per month — 5 times more than Google provides. Plus, Mapbox gives you gorgeous map styles and more customization options than you'll ever need.
But like any map API, there's a learning curve. This guide walks you through everything: account setup, API configuration, and building a basic map. By the end, you'll know exactly how Mapbox works and whether it's worth the effort for your store locator.
Related: What is geocoding? | Google Maps vs Mapbox
#Is Mapbox Free?
Yes, Mapbox is free for most small to medium websites. You get 50,000 map loads per month at no cost. For context, that's roughly 1,600 map views per day, which covers the vast majority of business websites. You only start paying once you exceed that threshold, and even then, pricing starts at $5 per 1,000 additional loads. Google Maps gives you 10,000 free Dynamic Maps loads per month, then starts at $7 per 1,000, and requires a billing account with a valid payment method.
#Mapbox vs Google Maps: Quick Comparison
Before we dive in, here's how the published map-load allowances compare:
| Map-load pricing | Mapbox GL JS | Google Dynamic Maps |
|---|---|---|
| Free monthly allowance | 50,000 loads | 10,000 loads |
| First paid band | $5 per 1,000 | $7 per 1,000 |
Bottom line: Mapbox publishes a larger free web-map allowance. Compare the exact products you need because pricing differs across maps, search, geocoding, and routing.
#Understanding Mapbox Pricing in 2026
Mapbox's pricing is refreshingly straightforward:
#Free Tier Includes
- 50,000 map loads/month (Mapbox GL JS)
- 100,000 temporary geocoding requests/month (address search)
- 100,000 directions requests/month
- Unlimited Mapbox Studio access (map styling)
#When You Pay
After the free tier:
- Map loads: $5 per 1,000
- Temporary geocoding: $0.75 per 1,000
- Directions: $2 per 1,000
Mapbox also offers volume discounts. Google requires a billing account with a valid payment method. For a full pricing breakdown with cost examples, see our complete Mapbox pricing guide.
#Step-by-Step: Setting Up Mapbox
Let's get your account and API ready.
#Step 1: Create a Mapbox Account
- Go to mapbox.com
- Click Sign up or Start building for free
- Enter your email and create a password
- Verify your email address
- Complete the short onboarding questionnaire
#Step 2: Get Your Access Token
Mapbox uses "access tokens" instead of API keys. Here's how to get yours:
- Log into your Mapbox account
- Navigate to Account > Tokens (or visit mapbox.com/account/access-tokens)
- You'll see a Default public token. this works for basic usage
- For production, click Create a token to make a restricted one
#Step 3: Create a Restricted Token (Recommended)
For production websites, create a token with URL restrictions:
- Click Create a token
- Name it (e.g., "Production - mywebsite.com")
- Under URL restrictions, add your domains:
1https://yourwebsite.com 2https://www.yourwebsite.com - Select the scopes you need:
styles:read(required for maps)fonts:read(required for labels)sprites:read(required for icons)
- Click Create token
- Copy the public token from the tokens page
#Step 4: Install Mapbox GL JS
You have two options:
Option A: CDN (easiest)
1<link href="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.css" rel="stylesheet">
2<script src="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.js"></script>
Option B: npm (for build systems)
1npm install mapbox-gl
1import mapboxgl from 'mapbox-gl';
2import 'mapbox-gl/dist/mapbox-gl.css';
#Step 5: Create Your First Map
Here's a complete, working example:
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="utf-8">
5 <title>Store Locator</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 <link href="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.css" rel="stylesheet">
8 <style>
9 body { margin: 0; padding: 0; }
10 #map { width: 100%; height: 500px; }
11 </style>
12</head>
13<body>
14 <div id="map"></div>
15
16 <script src="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.js"></script>
17 <script>
18 mapboxgl.accessToken = 'YOUR_ACCESS_TOKEN';
19
20 const map = new mapboxgl.Map({
21 container: 'map',
22 style: 'mapbox://styles/mapbox/streets-v12',
23 center: [-74.006, 40.7128], // [lng, lat] - note the order!
24 zoom: 12
25 });
26
27 // Add navigation controls
28 map.addControl(new mapboxgl.NavigationControl());
29
30 // Add a marker
31 new mapboxgl.Marker()
32 .setLngLat([-74.006, 40.7128])
33 .addTo(map);
34 </script>
35</body>
36</html>
Important: Mapbox uses [longitude, latitude] order, which is the opposite of Google Maps' {lat, lng}. This trips up many developers!
#Mapbox Map Styles
One of Mapbox's biggest strengths is the variety of built-in styles:
| Style | URL | Best For |
|---|---|---|
| Streets | mapbox://styles/mapbox/streets-v12 |
General purpose |
| Light | mapbox://styles/mapbox/light-v11 |
Minimal, clean look |
| Dark | mapbox://styles/mapbox/dark-v11 |
Dark mode websites |
| Satellite | mapbox://styles/mapbox/satellite-v9 |
Aerial views |
| Satellite Streets | mapbox://styles/mapbox/satellite-streets-v12 |
Satellite + labels |
| Outdoors | mapbox://styles/mapbox/outdoors-v12 |
Hiking, nature |
| Navigation Day | mapbox://styles/mapbox/navigation-day-v1 |
Driving directions |
You can also create completely custom styles in Mapbox Studio, including your brand colors, custom icons, and selective feature visibility.
#Building a Store Locator with Mapbox
Let's add real store locator functionality:
#Adding Multiple Markers with Popups
1const stores = [
2 {
3 name: "Downtown Store",
4 coordinates: [-74.006, 40.7128],
5 address: "123 Main St, New York, NY",
6 phone: "(555) 123-4567"
7 },
8 {
9 name: "Midtown Location",
10 coordinates: [-73.985, 40.7589],
11 address: "456 5th Ave, New York, NY",
12 phone: "(555) 987-6543"
13 }
14];
15
16stores.forEach(store => {
17 // Create popup
18 const popup = new mapboxgl.Popup({ offset: 25 })
19 .setHTML(`
20 <h3>${store.name}</h3>
21 <p>${store.address}</p>
22 <p>${store.phone}</p>
23 `);
24
25 // Create marker
26 new mapboxgl.Marker()
27 .setLngLat(store.coordinates)
28 .setPopup(popup)
29 .addTo(map);
30});
#Adding Search with Geocoding
Mapbox's Geocoding API converts addresses to coordinates:
1async function searchAddress(address) {
2 const token = mapboxgl.accessToken;
3 const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(address)}.json?access_token=${token}`;
4
5 const response = await fetch(url);
6 const data = await response.json();
7
8 if (data.features && data.features.length > 0) {
9 const [lng, lat] = data.features[0].center;
10
11 // Move map to searched location
12 map.flyTo({
13 center: [lng, lat],
14 zoom: 14
15 });
16
17 // Find nearby stores
18 findNearbyStores(lng, lat);
19 } else {
20 alert('Location not found');
21 }
22}
#Distance Calculation
Find stores within a certain radius:
1function calculateDistance(lng1, lat1, lng2, lat2) {
2 const R = 3959; // Earth radius in miles
3 const dLat = (lat2 - lat1) * Math.PI / 180;
4 const dLng = (lng2 - lng1) * Math.PI / 180;
5 const a =
6 Math.sin(dLat/2) * Math.sin(dLat/2) +
7 Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) *
8 Math.sin(dLng/2) * Math.sin(dLng/2);
9 const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
10 return R * c;
11}
12
13function findNearbyStores(searchLng, searchLat, radiusMiles = 25) {
14 return stores
15 .map(store => ({
16 ...store,
17 distance: calculateDistance(
18 searchLng, searchLat,
19 store.coordinates[0], store.coordinates[1]
20 )
21 }))
22 .filter(store => store.distance <= radiusMiles)
23 .sort((a, b) => a.distance - b.distance);
24}
#Custom Markers
Replace the default blue pin with custom HTML markers:
1stores.forEach(store => {
2 // Create custom marker element
3 const el = document.createElement('div');
4 el.className = 'custom-marker';
5 el.innerHTML = `
6 <div style="
7 background: #ff6b35;
8 color: white;
9 padding: 8px 12px;
10 border-radius: 20px;
11 font-weight: bold;
12 box-shadow: 0 2px 6px rgba(0,0,0,0.3);
13 ">
14 ${store.name}
15 </div>
16 `;
17
18 new mapboxgl.Marker(el)
19 .setLngLat(store.coordinates)
20 .addTo(map);
21});
#Common Mapbox Issues and Fixes
#"Error: A valid access token is required"
Your access token is missing or invalid. Double-check:
- You're using the full token string
- No extra spaces or line breaks
- The token hasn't been deleted from your account
#Map doesn't show, just gray box
Common causes:
- Missing CSS file (mapbox-gl.css)
- Container has no height defined
- JavaScript errors blocking execution
Check browser console for specific errors.
#Markers at wrong positions
Remember: Mapbox uses [longitude, latitude] order!
1// WRONG
2[40.7128, -74.006] // lat, lng
3
4// RIGHT
5[-74.006, 40.7128] // lng, lat
#Map loads slowly
Optimize with:
- Use the compact CSS:
mapbox-gl.css - Lazy load the map on scroll
- Limit initial markers visible
- Use clustering for many points
#Skip the Complexity: Use StoreRocket Instead
StoreRocket lets you build a store locator with Mapbox or Google Maps without writing the surrounding application yourself.
StoreRocket gives you:
- ✅ Both Google Maps AND Mapbox support
- ✅ Connect your Google Maps or Mapbox key once
- ✅ Beautiful, customizable themes
- ✅ Visual location management
- ✅ Google Sheets sync
- ✅ Built-in search and filtering
- ✅ Analytics and heatmaps
- ✅ Lead capture forms
- ✅ Mobile-responsive
- ✅ Zero coding required
#Why Mapbox + StoreRocket?
You get the best of both worlds:
- Mapbox's beautiful map styles
- StoreRocket's ease of use
- Switch between Google Maps and Mapbox anytime
- Connect your map-provider key once in the dashboard
#Frequently Asked Questions
#Is Mapbox really free?
Yes, for up to 50,000 Mapbox GL JS loads per month. Google instead requires a billing account with a valid payment method.
#Is Mapbox better than Google Maps?
It depends on the map products and features your implementation needs. Compare the documented pricing and capabilities for that exact mix.
#Can I use Mapbox for commercial projects?
Mapbox's pay-as-you-go terms cover many public web and mobile uses. Its pricing page lists separate Commercial Application Licences for specified vehicle, business-intelligence, analytics, sales-performance, cloud-database, and real-estate uses, so check your application's licence category as well as its usage allowance.
#Does Mapbox work on mobile?
Yes, Mapbox GL JS is fully responsive and touch-friendly. They also offer native iOS and Android SDKs.
#Can I use both Google Maps and Mapbox?
With DIY code, you'd need separate implementations. With StoreRocket, you can switch between them with one click.
#How do I customize map colors to match my brand?
Use Mapbox Studio (studio.mapbox.com) to create custom styles. It's a visual editor, no code required. Then use your custom style URL instead of the default.
#Ready to Build Your Store Locator?
Mapbox is a fantastic mapping platform with a generous free tier. If you love building things from scratch and have the development time, it's a solid choice.
But if you want your store locator live today. with all the features your customers expect, try StoreRocket free for 7 days.
Choose Google Maps or Mapbox. Get analytics, lead capture, and Google Sheets sync included. No coding required.
Your customers are searching for your stores right now. Help them find you.
Questions about Mapbox vs Google Maps for your specific use case? Talk to our team, we'll help you choose.