How to create and use custom search engines in Chrome for more efficient searching and increased productivity
Tags: googlechrome, productivity, bookmarklet
Published: 2020-06-10 13:25:45

_If you like this article, chances are you will like my tweets too. If you are curious, have a look at my [Twitter profile](https://twitter.com/natterstefan). 🚀_

![Chrome's Search Engines](https://dev-to-uploads.s3.amazonaws.com/i/t41tdo8g3mnjchbxp9wp.png)

In the picture above you see a list of pre-defined search engines of Google Chrome. They can save time when looking up a question on Google or finding a product on Amazon. Did you know that you can customize them to increase your productivity? No? Then I have got an interesting and helpful tip for you today - use and customize Google Chrome's search engines to make your life easier.

---

When you are looking up a topic on Google, do you open google.com or do you use the browser's built-in search feature?

Most of you probably write "google" into the address bar, press tab, enter the query, and hit enter, right? This works with other websites too, like dict.cc, YouTube, and Amazon for instance. This is the search engine feature.

You enter a **keyword**, hit **tab**, provide a **query**, and finally execute the **search**.

These are the individual parts of the feature. What can we do with this feature and how can we create our own search engine? I have prepared some examples for you.

 We can use search engines for

- custom search engines
- bookmarklets
- bookmark shortcuts

Let's take a look at each example.

## Set up custom search engines

Did you know that [Google has multiple search operators](https://ahrefs.com/blog/google-advanced-search-operators/)? That is quite a lot. You can use them to customize your search query. That is very helpful. These are the ones I use pretty often:

- `filetype:`
- `site:`
- `inurl:`
- `intext:`
- `intitle:`
- `define:`
- and the `-` (minus) operator

They all support you in finding what is relevant for you faster. For the first custom search engine, I have chosen the `define` operator. Here is how it looks like in action:

![Google Search Engine - Define](https://dev-to-uploads.s3.amazonaws.com/i/skkmzinibqmor8cbq4uw.gif)

Instead of visiting google.com and remembering the search operator, I have created a search engine. This is way faster and I remember this search operator exists. 🚀

Setting up a custom search engine is easy. Here is a step-by-step manual for my `define` example:

1. Open Chrome's settings page ("CMD+," on macOS, or enter `chrome://settings` in the address bar)
2. Click on "Search Engines" in the side menu (or enter `chrome://settings/searchEngines` in the address bar)
3. Press the "Add" button above "Other search engines"

You should now see a screen like to this:

![Add custom search engine](https://dev-to-uploads.s3.amazonaws.com/i/jx8nkz3n2hhc69ubu5sk.png)

My "define" search engine has the following values:

- Search engine: "AA Define a Word"

You probably add more custom search engines once you see their value. Adding a prefix (e.g. "AA") will ensure you can differentiate custom and automatically created search engines quickly.

- Keyword: "define"

This is the keyword you need to enter to select a search engine.

- URL with %s in place of query: `{google:baseURL}search?q=define%3A%20%s&hl=en`

The magic happens in the last field, the URL. This URL will be opened when you hit enter in the address bar. `%s` resolves to the entered text. Add it at the proper position in the URL and save the search engine.

The final result should look like this:

![Custom Search Engine - Define](https://dev-to-uploads.s3.amazonaws.com/i/jyum6s6bc7qcixh2vobm.png)

Congratulations, you created your first custom search engine shortcut! 🚀 Now you can enter `define` and execute it. Cool, isn't it?

Let's take a look at a few other use cases.

### Filetype search operator

- `pdf`, `docx` and `pptx`: enable quick file type lookups on Google

```
Search engine: AA Find PDF
Keyword: pdf
URL: {google:baseURL}search?q=%s+filetype%3Apdf&hl=en

Search engine: AA Find DOCX
Keyword: docx
URL: {google:baseURL}search?q=%s+filetype%3Adocx&hl=en

Search engine: AA Find PPTX
Keyword: pptx
URL: {google:baseURL}search?q=%s+filetype%3Apptx&hl=en
```

### Bookmarklets

- `sons` (search on site): It takes the current site that I’m on and performs a `site:domain.com` search on Google.

```
Search Engine: AA Find on Current Site
keyword: sons
URL: javascript:!function(){var s=prompt("Search current site for what?","");window.open("https://www.google.com/search?q="+encodeURIComponent(s)+"+site:"+window.location.hostname)}();
```

- `setcookie` and `deletecookie`: You need to set and delete cookies on a page pretty often (we do this in our dev setup for instance)? Then this bookmarklet and search engine is for you:

```js
// setCookie
javascript: void (function () {
  var d = new Date();
  d.setDate(new Date().getDate() + 365);
  document.cookie = "nocache=1;expires=" + d.toGMTString() + ";path=/;";
  window.location.reload(true);
})();

// deleteCookie
javascript: void (function () {
  var d = new Date();
  d.setSeconds(new Date().getSeconds() + 1);
  document.cookie = "nocache=;expires=" + d.toGMTString() + ";path=/;";
  window.location.reload(true);
})();
```

In this example, the cookie is set to `nocache=1`. But you can also make it more dynamic:


```js
// setCookie
javascript: void (function () {
  var cookieToSet = prompt("Cookie (e.g. 'test=1'):", "");

  if (cookieToSet) {
    var d = new Date();
    d.setDate(new Date().getDate() + 365);
    document.cookie = cookieToSet + ";expires=" + d.toGMTString() + ";path=/;";
    window.location.reload(true);
  }
})();

// deleteCookie
javascript: void (function () {
  var cookieToSet = prompt("Cookie (e.g. 'test'):", "");

  if (cookieToSet) {
    var d = new Date();
    d.setSeconds(new Date().getSeconds() + 1);
    document.cookie = cookieToSet + "=;expires=" + d.toGMTString() + ";path=/;";
    window.location.reload(true);
  }
})();
```

These bookmarklets can delete and set a cookie which expires in 365 days from now. You can create cookie bookmarklets with [cookie-bookmarklet-generator](https://cookie-bookmarklet-generator.com/) in seconds.

![Set Cookie Bookmarklet](https://dev-to-uploads.s3.amazonaws.com/i/liumi2r3533zpzxdu1m4.png)

### Bookmarks

You can use search engines as shortcuts for bookmarks too.

- `dev`: opens `https://dev.to/`.
- `ga`: opens `https://analytics.google.com/analytics/web/`
- `lorem`: opens `https://www.loremipsum.de`.

![dev.to](https://dev-to-uploads.s3.amazonaws.com/i/qv7ausrbae3i8nb3rkzj.gif)

## Summary

Custom search engines come in very handy. Quickly find what you are looking for, create bookmarks, or utilize bookmarklets.

I am always curious to find new ones, so let me know below in the comments what you have set up.

----

## References

- [Advanced Google Chrome Bookmarklets for SEOs: A Detailed Guide](https://detailed.com/chrome-bookmarklets-seo/)
- [Set your default search engine](https://support.google.com/chrome/answer/95426?co=GENIE.Platform%3DDesktop&hl=en)

---

\>> Let's connect on Twitter 🐦: https://twitter.com/natterstefan
\>> Subscribe to my newsletter 👨🏻‍💻: https://newsletter.natterstefan.me