Google Search Console

Google Search Engine URL With S in Place of Query

Rate this article

Share this article

What Does %s Mean in a Search Engine URL?

If you’ve ever dug into your browser’s search engine settings, you’ve likely seen a URL that looks something like this:

https://www.google.com/search?q=%s

That %s is a placeholder — a substitution marker. When you type a query and press Enter, your browser replaces %s with your actual search terms, URL-encoded so that spaces become + or %20 and special characters are safely transmitted. It’s the universal shorthand that every major browser uses to define a custom search engine URL template.

The name comes from C-style string formatting, where %s means “substitute a string here.” Browsers adopted the same convention as a consistent way for users and developers to describe where a search term belongs inside a URL.

Understanding how %s works unlocks a powerful browser feature: the ability to assign short keywords so you can jump directly to any site’s search results from your address bar. Type gh react hooks and land straight on GitHub search results. Type mdn Array.prototype.map and hit the MDN docs instantly. Type yt lofi beats and open a YouTube search — all without touching the mouse. This guide covers everything from the basics through advanced automation.


How Browsers Use the %s Placeholder

All major desktop browsers support a search engine URL template with %s:

  • Google Chrome — Manages these under Settings → Search engine → Manage search engines and site search
  • Mozilla Firefox — Uses keyword bookmarks (no %s required in the URL — Firefox inserts the query automatically)
  • Microsoft Edge — Same mechanism as Chrome; found under Settings → Privacy, search, and services → Address bar and search
  • Safari — Supports the %s pattern indirectly via third-party extensions, but does not expose native custom search engine management to users

When you type a registered shortcut keyword followed by a space and then your query, the browser takes the URL template, replaces %s with the URL-encoded version of your query, and navigates to the resulting URL. The whole thing is transparent and instantaneous.


Adding a Custom Search Engine in Chrome

Chrome makes it straightforward to register any URL that accepts a query string as a custom search engine.

Step-by-Step Instructions

  1. Open Chrome and click the three-dot menu (⋮) in the top-right corner.
  2. Go to Settings.
  3. In the left sidebar, click Search engine.
  4. Click Manage search engines and site search.
  5. Scroll down to the Site search section and click Add.
  6. Fill in the three fields:
    • Name — A friendly label (e.g., GitHub Code Search)
    • Shortcut — The keyword you’ll type in the address bar (e.g., gh)
    • URL with %s in place of query — The full search URL with %s where the query goes (e.g., https://github.com/search?q=%s)
  7. Click Add to save.

To test it, click the address bar, type your shortcut keyword (e.g., gh), press Space or Tab, type a query, and press Enter. Chrome will navigate directly to the search results on that site.

Setting a Custom Search Engine as Default

If you want a custom search engine to be the default for all address bar searches (not just via a shortcut), click the three-dot menu next to it in Manage search engines and choose Make default. This replaces Google as the default engine for that Chrome profile.


Adding Keyword Search in Firefox

Firefox handles this slightly differently through keyword bookmarks. Rather than a dedicated “search engine” UI, you attach a keyword to any bookmark whose URL contains %s.

Method 1: Bookmark with %s Keyword

  1. Press Ctrl+L (or Cmd+L on Mac) to focus the address bar.
  2. Navigate to the site you want to search (e.g., https://stackoverflow.com/search?q=your+query).
  3. Right-click the address bar and choose Add Bookmark, or press Ctrl+D.
  4. In the bookmark dialog, click More… to expand options.
  5. In the URL field, replace the actual query text with %s (e.g., https://stackoverflow.com/search?q=%s).
  6. In the Keyword field, enter a short shortcut (e.g., so).
  7. Click Save.

Method 2: Use the Right-Click Search Shortcut

  1. Go to any site that has a search box.
  2. Right-click inside the search input field.
  3. Select Add a Keyword for this Search.
  4. Give the bookmark a name and keyword, then click Save.

Firefox will automatically construct the correct %s URL from the form’s action attribute. After saving, type your keyword in the address bar followed by a space and your query to search directly.


Common Google Search URL Patterns with %s

Google exposes different search surfaces through distinct URL parameters. Here are the most useful templates:

Search Type URL Template Suggested Shortcut
Web search https://www.google.com/search?q=%s g
Image search https://www.google.com/search?tbm=isch&q=%s gi
Google Maps https://www.google.com/maps/search/%s gm
YouTube https://www.youtube.com/results?search_query=%s yt
Google News https://news.google.com/search?q=%s gn
Google Scholar https://scholar.google.com/scholar?q=%s gs
Google Shopping https://www.google.com/search?tbm=shop&q=%s gsh

The tbm parameter tells Google which tab to show. Other useful values include tbm=vid (videos) and tbm=bks (books). You can combine these with other parameters — for example, to restrict results to the last week: https://www.google.com/search?q=%s&tbs=qdr:w.


Using %s for Other Popular Sites

The same technique works for virtually any website with a predictable search URL structure. Here are ready-to-use templates for common developer and research sites:

Site URL Template Suggested Shortcut
Amazon https://www.amazon.com/s?k=%s az
Wikipedia https://en.wikipedia.org/wiki/Special:Search?search=%s w
Stack Overflow https://stackoverflow.com/search?q=%s so
GitHub https://github.com/search?q=%s gh
MDN Web Docs https://developer.mozilla.org/en-US/search?q=%s mdn
npm https://www.npmjs.com/search?q=%s npm
PyPI https://pypi.org/search/?q=%s pypi
Reddit https://www.reddit.com/search/?q=%s r
DuckDuckGo https://duckduckgo.com/?q=%s ddg

To find the right URL template for any site, perform a search on that site, then look at the resulting URL in your browser’s address bar. Identify where your query appears in the URL, and replace it with %s. If the query contains spaces, the browser will automatically URL-encode them as + or %20 when it fills in the placeholder.


Troubleshooting: Common Mistakes

1. Forgetting URL Encoding

The browser handles URL encoding for you when it substitutes %s — you do not need to pre-encode the placeholder. However, problems arise when the rest of your URL template contains unencoded characters. For example, if a URL uses an ampersand to separate parameters (&), make sure you don’t accidentally paste an HTML entity (&) into the URL field — that’s valid HTML but not a valid URL.

Broken: https://www.google.com/search?tbm=isch&q=%s
Correct: https://www.google.com/search?tbm=isch&q=%s

2. Using %s Without a Query Parameter Key

The %s placeholder replaces only the value of a query parameter, not the entire query string. You must include the parameter name and the equals sign before it.

Broken: https://www.google.com/search?%s
Correct: https://www.google.com/search?q=%s

3. Wrong URL Format for the Site

Some sites use POST requests for their search forms rather than GET requests, which means the search query doesn’t appear in the URL at all. In these cases, you can’t use the %s trick directly. Check whether a public search URL exists — many sites that use POST internally also expose a GET endpoint (e.g., /search?q=term). If not, the site may not support this approach.

A quick way to check: perform a search on the site, then copy the resulting URL from your address bar. If the URL looks like https://site.com/search?q=your+query or similar, you’re good — just swap the query for %s. If the URL doesn’t change at all after the search (stays at the homepage, for example), the site likely uses a POST-only form.

4. The Shortcut Keyword Conflicts with a Site

If Chrome auto-detects a site’s search (through OpenSearch discovery) and assigns a keyword identical to yours, your custom entry may be overwritten. If you notice a shortcut stops working, go back to Manage search engines and check whether the auto-detected entry replaced yours. Use a more unique keyword to avoid collisions.

5. %s Not Replaced — Appears Literally in the URL

This happens when the browser does not recognize the entry as a search engine shortcut. Common causes: you may have entered the URL in a regular bookmark (without assigning it as a search engine), or you’re using a browser that doesn’t support the %s pattern. Double-check under Manage search engines (Chrome) or verify the keyword is set in the bookmark properties (Firefox).

6. Multi-Word Queries Cause Unexpected Results

Browsers automatically URL-encode spaces in your query. Depending on the site, the expected encoding may be + (as in hello+world) or %20 (as in hello%20world). Most major sites accept both, so this is rarely an issue — but if results seem off for multi-word queries, inspect the URL in your address bar after navigating to confirm the encoding looks right. Some URL templates also support restricting the encoding style, though this is an advanced edge case.


Advanced: Using %s in Alfred, Raycast, iOS Shortcuts, and Automation Tools

The %s URL pattern extends far beyond your browser. Productivity launchers and automation tools use the same concept — sometimes with slightly different syntax.

Alfred (macOS)

Alfred’s Web Search feature uses {query} as its placeholder rather than %s, but the concept is identical. To add a custom web search in Alfred:

  1. Open Alfred Preferences → FeaturesWeb Search.
  2. Click Add Custom Search.
  3. Enter the search URL using {query} as the placeholder (e.g., https://github.com/search?q={query}).
  4. Set a keyword and a title.
  5. Click Save.

In Alfred, type your keyword followed by a space and your search term to trigger it instantly.

Raycast (macOS)

Raycast’s Quicklinks also use {Query} (capital Q) as the placeholder:

  1. Open Raycast and search for Create Quicklink.
  2. Set the Name and a unique keyword.
  3. Enter the URL with {Query} as the placeholder (e.g., https://www.npmjs.com/search?q={Query}).
  4. Save the Quicklink.

Trigger it by typing the keyword in Raycast and entering your query.

iOS Shortcuts

iOS Shortcuts can open URLs dynamically. To build a search shortcut:

  1. Create a new Shortcut and add the action Ask for Input (type: text).
  2. Add a URL Encode action on the result.
  3. Add an Open URL action with the URL constructed as: https://www.google.com/search?q= followed by the encoded input variable.
  4. Add the Shortcut to your home screen or invoke it via Siri.

Because iOS Shortcuts builds the URL programmatically, you handle the %s substitution manually — but the result is the same.

AutoHotkey (Windows)

On Windows, AutoHotkey can replicate the same behaviour with a hotkey that reads the clipboard or prompts for input:

; Press Win+G to search Google with clipboard contents
#g::
  query := Clipboard
  Run, https://www.google.com/search?q=%query%
return

Note that AutoHotkey uses %variableName% for variable substitution — not to be confused with the URL %s placeholder.

curl and Shell Scripts

In shell scripts, you can replicate the same URL-with-placeholder pattern using a shell variable:

query="open source search engine"
encoded=$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote_plus(sys.argv[1]))" "$query")
curl "https://www.google.com/search?q=${encoded}"

This is particularly useful when building automation pipelines that need to trigger search-based lookups.


Adding Custom Search to Your Own Website

All of the above assumes you’re searching other websites. But what if you want visitors to your own site to be able to search it — and ideally let them add your site as a browser search engine shortcut?

The key is to expose a clean, predictable search URL on your site (e.g., https://yoursite.com/search?q=term). You can also declare your search endpoint via an OpenSearch description document, which lets browsers like Chrome and Firefox auto-discover your search engine and offer to add it.

If you need a powerful, accurate search experience for your website visitors — one that works well enough that people will actually want to use it as a shortcut — ExpertRec provides a plug-and-play custom search engine that indexes your site and delivers fast, relevant results. ExpertRec integrates easily with WordPress, custom sites, and e-commerce platforms, and its results pages use standard, crawlable URLs compatible with the %s pattern.


Quick Reference: Browser Support Summary

Browser Supports %s Templates? Where to Configure Placeholder Syntax
Google Chrome Yes Settings → Search engine → Manage search engines %s
Microsoft Edge Yes Settings → Privacy, search, and services → Address bar %s
Mozilla Firefox Yes (keyword bookmarks) Bookmark properties → Keyword field %s
Safari Limited (via extensions) Third-party extensions only Varies by extension
Opera Yes Settings → Search → Manage search engines %s
Brave Yes (Chromium-based) Settings → Search engine → Manage search engines %s

Summary

The %s placeholder in a browser search engine URL is a simple but powerful convention. It tells your browser exactly where to insert your query when you use a keyboard shortcut to search a specific site. To recap the key points:

  • %s marks the query position in a URL template — the browser replaces it with your URL-encoded search terms.
  • Chrome and Edge manage these under Manage search engines in Settings.
  • Firefox uses keyword bookmarks — right-click a search field and select Add a Keyword for this Search.
  • Any site with a GET-based search URL can be turned into a browser shortcut.
  • Productivity tools like Alfred and Raycast use equivalent placeholder syntax ({query}) for the same purpose.
  • Common mistakes include using HTML entities inside URLs and omitting the parameter key before %s.

Once you’ve set up a handful of search shortcuts for the sites you use daily, you’ll wonder how you ever lived without them.

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like