SharePoint Online: Hide Search Box in the Top Navigation Suite bar

Requirement: Hide Search Box in the Top Navigation Suite bar in SharePoint Online.

How to Remove the Search Box from the Top Navigation Suite bar?

In SharePoint Online, the search bar is a useful feature that allows users to quickly find content and documents within the platform. However, there may be instances where you want to hide the search bar for the entire site. In this guide, we will discuss the steps on how to hide the search bar in SharePoint Online.

The search box in SharePoint Online’s top navigation suite bar can be hidden with this PowerShell script:

#Set Parameters
$SiteURL = ""

#Get Credentials to connect
$Cred = Get-Credential

Try {
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
    #Get Web object
    $Web = $Ctx.Web

    #Disable search in the navigation bar
    $Web.SearchBoxInNavBar = 3
Catch {
    write-host -f Red "Error:" $_.Exception.Message

SearchBoxInNavBar enumeration values:

  • Inherit = 0
  • AllPages = 1
  • ModernOnly = 2
  • Hidden = 3

We can also set search box settings using PnP PowerShell.

#Set Parameters
$SiteURL = ""

#Connect to SharePoint Online site
Connect-PnPOnline -Url $SiteURL -Interactive

#Hide Searchbox in the Navigation bar
Set-PnPSearchSettings -SearchBoxInNavBar Hidden -Scope Web -Force

This hides the search box from the top navigation bar of the SharePoint Online site in a few minutes. To enable the search box back in the Navigation bar, use:

Set-PnPSearchSettings -SearchBoxInNavBar ModernOnly -Scope Web

Also, you can set the search box visibility at the site collection level by changing the scope parameter from “Web” to “Site”

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

3 thoughts on “SharePoint Online: Hide Search Box in the Top Navigation Suite bar

Leave a Reply

Your email address will not be published. Required fields are marked *