How to add custom google search bar inside your web-page?

A search bar is necessary for a good website. Creating your own search engine from scratch might be a difficult task but this task can be skipped with the help of Google. Google has created a website to create a custom search bar, to create your own check the below link.



Creating a Custom Search Bar: On this website, anyone can easily program their search bar by just selecting the sites you want to be searched for. Follow the steps explained below.

  • Step 1: Go to the following site and hit Get Started button.
  • Step 2: Select the New search engine button to create a new search engine.
  • Step 3: Fill the details as directed on the page and then click the create button.
  • Step 4: After hitting create you will get your code by hitting the Get Code button on the screen shown.

Note: You can modify your setting about searching sites, searching images, safe search from control panel and you can also set to show advertisement while searching through your search bar.

Embedding the Search Bar on a Webpage: After getting your code you can simply paste it inside your web page to see the working search bar.

  • Example: You can see that the output screen has a search bar with an option to search which shows the result from the sites or domain you have selected while creating this search bar. Moreover, this search option will automatically change as you change the sites from the control panel. Currently, the search results are been shown in the default manner. Apart from that, you can manipulate the result displaying manner and much more as directed on the below links







    <!DOCTYPE html>
            <title>Custom Search-Bar</title>
                body {
                    background-image: linear-gradient(to left, white, green);
                    color: lawngreen;
            <h1 style="text-align: center;">GeeksforGeeks</h1>
            <script async src=
            <div class="gcse-search"></div>



  • Output:
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.