Here are steps to add DuckDuckGo site search engine search to your website. In this article, we will discuss how to add this search engine in your website.
Steps:
Add the following code to your website
<!-- DuckDuckGo Site Search -->
<form
id="ddg-site-search"
action="https://duckduckgo.com/"
method="get"
target="_blank"
>
<input
type="search"
name="q"
id="ddg-query"
placeholder="Search this site..."
aria-label="Search this site"
required
/>
<button type="submit">Search</button>
</form>
<script>
(function () {
const form = document.getElementById("ddg-site-search");
const input = document.getElementById("ddg-query");
form.addEventListener("submit", function () {
const domain = window.location.hostname;
input.value = "site:" + domain + " " + input.value;
});
})();
</script>
Advantages of using DuckDuckGo Search
- DuckDuckGo is free.
- Unlimited- Irrespective of how many users your site has, the search engine can handle it.
Disadvantages of DuckDuckGo Search
- DuckDuckGo has ads in search results. This could mean you could lose hard-earned traffic to competitors.
- No UI editor- Duckduckgo has no inbuilt controls to edit the look and feel of the search engine. This means you will have to get into coding to make the search engine look in sync with your website.
- No control over what is crawled- Duckduckgo doesn’t give any controls over what is crawled and when it is crawled. So when you update any content on your website, it might take a pretty long time to reflect in your search results.
- The above code just does a site:yourwebsite.com on DuckDuckGo.
Expertrec- Overcoming disadvantages of DuckDuckGo
You can overcome disadvantages of DuckDuckGo by creating a custom search engine with Expertrec. It has zero ads in search results and also has a codeless UI editor that can help you match your website search engine to the look and feel of your website.

Here are 5 easy steps to create a custom search engine with Expertrec
- Go to no code custom search creator.
- Sign in with your Gmail ID.
- Add your website and sitemap URL.
- Wait for crawl to create.
- Add code to your website from here and take live.

FAQ – DuckDuckGo Site Search on Your Website
How does this DuckDuckGo site search work?
The search form takes whatever the user types and automatically prefixes it with
site:yourdomain.com before sending it to DuckDuckGo. This tells DuckDuckGo
to show results only from your website, not the entire web.
Will this search box only show results from my website?
Yes. Because the query is rewritten to include site:yourdomain.com,
DuckDuckGo restricts results to pages it has indexed from your domain. If a page
isn’t indexed yet, it may not appear in the results.
Does this affect my website’s SEO?
No. This setup doesn’t change your on-page content or metadata. It simply sends
a normal DuckDuckGo search query with a site: filter. However, it can
improve user experience by helping visitors find content faster, which is indirectly
good for SEO.
Can I customize the styling of the search box and FAQ accordions?
Yes. You can edit the CSS in the <style> section for the FAQs and
add your own classes to the search form. Adjust fonts, colors, borders, spacing, and
button styles to match your theme.
Does DuckDuckGo track my users when they search?
DuckDuckGo is known for its privacy-focused approach and does not create personal
search profiles. Still, all searches are sent to DuckDuckGo’s servers like any other
web search, so you should link to their privacy policy if this is important for your
audience or compliance.
Can I open the DuckDuckGo results in the same tab instead of a new tab?
Yes. In the search form code, simply remove the target="_blank" attribute
from the <form> tag. Results will then open in the same browser tab.



