How to Delete a SharePoint Site: Step-by-Step Guide

SharePoint Online site collection is a collection of sites grouped under a common URL and typically share a common navigation, branding, features, security, etc. When it comes to managing content in SharePoint Online, you may, at some point, need to delete a site when you no longer require it. E.g., a Project completed, a Temporary site, or maybe it was created mistakenly.

Whatever the reason, you can delete a site in SharePoint Online to free up storage space and other resources by following the steps outlined in this tutorial. We will cover the steps required to delete SharePoint sites, whether they are classic sites or modern sites. We will also look at the permissions required and where to go in the SharePoint admin center to delete sites and recycle bins to be aware of. Let’s understand the proper procedures for permanently removing SharePoint sites when they need to be cleaned up or eliminated.

How to Delete a SharePoint Online Site?

As a SharePoint Online Site Admin, you can delete any SharePoint site in the tenant. This article will walk you through the process of deleting your site entirety, which includes all data, lists, libraries, and files associated with it. Before you begin this process, it’s a good idea to make sure that the site is no longer required. Deleting a site collection is quite a straightforward process. To delete a SharePoint Online site collection from the Admin center, follow these steps:

  1. Open SharePoint Online Admin Center as a Global Administrator or SharePoint Administrator (Typically at https://tenant-admin.sharepoint.com)
  2. Click on Sites >> Active Sites in the left navigation. From the site collections list, choose the site you want to delete. From the Toolbar, click Delete and then confirm by a prompt by clicking the “Delete” button in the command bar.
    delete sharepoint online site using powershell

If you want to delete multiple sites, select them under the “Active Sites” list, Click on “Bulk edit” and then select “Delete” from the toolbar!

delete multiple sharepoint sites

Once deleted, the selected site will be removed from the “Active sites” list. If you selected an Office 365 group-connected site, you’d get a prompt with an option to delete the associated Microsoft 365 group as well. Deleted sites are retained for 93 days in SharePoint Online and will be permanently deleted automatically. However, the deleted Office 365 groups are kept for only 30 days in the Azure AD Recycle Bin. So, it’s a good idea to check with the group owner and make sure the site can be deleted. It’s worth checking the site usage report as well.

Deleting a Modern SharePoint Site from Site Settings

If you possess site owner or SharePoint Administrator (or site collection Admin rights), you have the ability to delete a Modern communication site or team site. To do this, navigate directly to the site, click on the Settings gear icon, select the Site Information link, and then click on the Delete Site link. Confirm the warning message prompt to delete the site!

how to delete a site in sharepoint online

This action deletes all site contents, including site assets like document libraries and list data associated with that particular SharePoint Online site, along with the user information part of the site. The deletion process completes within a few minutes, depending on the size of the site or the amount of data being deleted. All these methods apply to sites associated with Hub as well.

Deleting a Classic Site

Deleting unnecessary sites can help reduce clutter and simplify the management of your SharePoint environment. Here is how you can delete the site by clicking the settings icon >> site settings page and clicking on the “Delete this site” link under the “Site Actions” heading, on classic SharePoint sites.

delete classic sharepoint site

Delete Multiple Site Collections in SharePoint Online

Similarly, You can delete multiple SharePoint Online sites using the new SharePoint Admin center by selecting more than one site collection >> Click on “Bulk Edit”>> Choose the “Delete” item in the menu and confirm the prompt!

delete multiple site collections in sharepoint online

Once deleted, You can find them under the “Deleted sites” link from the SharePoint Online admin center’s left navigation. Now, let’s delete a site collection in SharePoint Online with PowerShell!

How to Delete a SharePoint Online Site Collection Using PowerShell?

Other than the UI, Site deletion can be done with PowerShell as well. Here is the PowerShell script for SharePoint Online to delete the site collection. Use SharePoint Online Management Shell or PowerShell ISE to run these PowerShell commands.

Import-Module Microsoft.Online.Sharepoint.PowerShell

#Variables for processing
$AdminSiteURL = "https://crescent-admin.sharepoint.com"
$AdminName = "salaudeen@crescent.com"
$SiteCollURL = "https://crescent.sharepoint.com/sites/Sales"

#Credentials to connect 
$SecurePWD = ConvertTo-SecureString "Password" -asplaintext -force  
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $AdminName, $SecurePWD
 
#Connect to SharePoint Online
Connect-SPOService -url $AdminSiteURL -credential $Credential

#delete sharepoint online site collection using powershell
Remove-SPOSite -Identity $SiteCollURL -NoWait -Confirm:$false

Write-Host "Site collection has been deleted!"

SharePoint Online: Remove Site Collection with PowerShell

You can also use SharePoint Online Management Shell Remove-SPOsite PowerShell cmdlets to delete a SharePoint site:

# Variables
$AdminSiteURL = "https://crescent-admin.sharepoint.com/"
$SiteCollURL = "https://crescent.sharepoint.com/sites/itgroup"

# Connect to sharepoint online
Connect-SPOService -url "https://crescent-admin.sharepoint.com/" -credential (Get-Credential)

# sharepoint online powershell delete site collection
Remove-SPOSite -Identity $SiteCollURL -NoWait -Confirm:$false

This PowerShell deletes site collection in SharePoint Online. Please note that the Remove-SPOSite does not delete a site collection permanently. But it moves the site collection to the Recycle Bin.

Remove Site Collection using PowerShell CSOM

When you delete a SharePoint Online site, all subsites, pages, lists, libraries, and content are deleted. Here is how to delete a site with a client-side object model PowerShell script:

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"

#delete site collection sharepoint online powershell
Function Remove-SPOSiteCollection($AdminCenterURL,$SiteURL)
{
    Try {
        #Setup Credentials to connect
        $Cred= Get-Credential
             
        #Setup the Context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($AdminCenterURL)
        $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
  
        #Get the tenant object 
        $Tenant = New-Object Microsoft.Online.SharePoint.TenantAdministration.Tenant($Ctx)

        Write-Host -f Yellow "Deleting site collection..." 
        #delete a sharepoint online site powershell
        $Tenant.RemoveSite($SiteURL) | Out-null
        #$Tenant.RemoveDeletedSite($SiteURL) #To delete site from recycle bin!
        $ctx.ExecuteQuery()
        Write-host "Site Collection Deleted Successfully!" -foregroundcolor Green
    }
    catch {
        write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
    }
}
#Set Parameters
$AdminCenterURL = "https://Crescent-admin.sharepoint.com"
$SiteURL = "https://Crescent.sharepoint.com/sites/procurement"

#Call the function to delete site collection
Remove-SPOSiteCollection $AdminCenterURL $SiteURL
Permissions to Delete a Site in SharePoint Online
To delete a SharePoint Online Site Collection, You need to be a Site Collection Administrator / SharePoint Online Admin / Global Admin!

What happens when a Microsoft SharePoint site is deleted? Both the above PowerShell cmdlets and the web browser methods send the site collection to the recycle bin but don’t remove the site collection permanently.

Permanently Delete a SharePoint Site Collection

When you delete a site collection, it goes to the recycle bin. You may want to permanently delete that site collection to reuse the storage space or recreate a new one with the same URL. Because, If you try to create a site collection with a deleted site in the recycle bin, SharePoint gives you a message “The site address is available with modification” and doesn’t allow you to use the same URL!

powershell to delete sharepoint online site collection

How to Delete a Site Permanently in SharePoint Online?

How to permanently delete a SharePoint Online site? Here are the steps to delete a site collection permanently in SharePoint Online:

  1. Login to the new admin center site.
  2. Click on “Deleted Sites” from the left navigation. This lists all deleted sites in the tenant within the past 93 days.
  3. Select the site you want to permanently delete, click the “Permanently Delete” button in the Toolbar, and click on “Delete” in the confirmation box.
sharepoint online permanently delete site collection powershell

However, if you try to permanently delete a modern Office 365 group site using the above steps, You’ll find the Permanently delete button is disabled! So, the only way to permanently remove deleted Modern sites is PowerShell! Let’s delete a site collection in SharePoint Online using PowerShell.

SharePoint Online PowerShell to Delete Site Collection Permanently from Recycle Bin

We can use PowerShell to remove a deleted site in SharePoint Online. To permanently delete site collection from the recycle bin, use the below script in SharePoint Online Management Shell: 

$DeletedSiteCollURL = "https://crescent.sharepoint.com/sites/deletedsite"

#Remove Deleted SharePoint Online Site Collection permanently
Remove-SPODeletedSite -identity $DeletedSiteCollURL -Confirm:$false

This deletes the particular site from the recycle bin. Replace the $DeletedSiteCollURL with the site URL you wish to delete from the recycle bin.

SharePoint Online PnP PowerShell to Delete a Site Collection

Here is how to delete a site from SharePoint using PnP PowerShell:

#Config Variables
$SiteURL = "https://Crescent.sharepoint.com/sites/Procurement"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
    
#sharepoint online delete site collection powershell
Remove-PnPTenantSite -Url $SiteURL -Force 

Be sure to specify the site’s URL per your tenant.

To delete multiple SharePoint sites, You can wrap the Site URLs in an Array, loop through the array and delete the sites in bulk!

To permanently delete site collection with PnP PowerShell, use the -SkipRecycleBin switch.

Remove-PnPTenantSite -Url $SiteURL -Force -SkipRecycleBin

When you use the SkipRecycleBin switch, the site will be permanently deleted. Once it is permanently deleted, you will need Microsoft support to restore a deleted SharePoint site.

To remove a deleted site collection from the recycle bin with PnP PowerShell, use the below cmdlet:

Remove-PnPTenantSite -Url $SiteURL -FromRecycleBin 
If you get: “Access denied You do not have permission to perform this action or access this resource” error when trying to delete a site using Remove-SPOSite or Remove-PnPTenantSite, Add to site collection Administrator Role for the site first!

Removing stale content not only helps us to reduce storage costs, but also helps users to find the right content they’re looking for more quickly – as we remove unnecessary sites. If you’ve accidentally deleted a SharePoint Online site, don’t worry – it can be restored within 93 days! Here are the necessary steps to restore a deleted site: How to Restore a Deleted Site in SharePoint Online?

Conclusion

Deleting a SharePoint site is a fairly straightforward process, but it’s important to understand the implications before proceeding. When a site is deleted, all of its content and subsites are permanently removed. You’ll need to be a SharePoint Administrator or site owner or have full control permissions to delete a site.

Before deleting a site, back up or move any important data you want to retain. Also, confirm there are no business needs tied to the site or dependencies with other systems. Check with site stakeholders before removing an actively used site. With the proper precautions taken, deleting unnecessary SharePoint sites can help declutter your environment and free up valuable storage space.

Can I delete the Root Site Collection SharePoint Online?

No! You can’t delete the root site collection in SharePoint Online through the SharePoint Admin Center. If you use other methods like PowerShell to delete, All other site collections and OneDrive will be inaccessible for all users until you either restore the site or create a new root site. Instead of deleting and recreating a SharePoint Online root site collection, you can use this method: How do you replace a classic root site in SharePoint Online with a modern site?

How do I delete OneDrive for business collection in SharePoint online?

If you no longer need a OneDrive for Business site, you can delete it by navigating to the URL: https://-my.sharepoint.com/personal/_Tenant_com/_layouts/15/Deleteweb.aspx) and then click on the “Delete” button. Be sure you replace the “Tenant” and “UserLogin” placeholders in the URL accordingly.
More info: How to Delete OneDrive for Business Site Collection?

How do I delete a subsite in SharePoint Online using PowerShell?

To delete a SharePoint subsite with PnP PowerShell, use the Remove-PnPWeb cmdlet. You can also use the CSOM method $web.DeleteObject() to remove a subsite in SharePoint Online. Deleted subsites end up in the Site Collection’s Recycle bin (also called the second-stage Recycle Bin).
More info: Delete a subsite SharePoint Online

How do I permanently delete a SharePoint site in PowerShell?

To permanently delete a SharePoint site using PowerShell, connect to your SharePoint Online tenant using Connect-SPOService. Then, use Remove-SPOSite followed by the URL of the site you want to delete. Finally, Run the Remove-SPODeletedSite cmdlet to permanently delete the site.

Does deleting a SharePoint site delete the group?

If the SharePoint site is connected to an Office 365 group, deleting the site will also delete the group and all its resources, including the planner, group mailbox, calendar, etc.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “How to Delete a SharePoint Site: Step-by-Step Guide

  • Do I need Tenant admin roles to delete a site collection?

    Reply
    • Site collection Administrators can delete a site from site settings page or with PnP PowerShell. However for SharePoint Online Admin Center or SPO cmdlets, You need to have “SharePoint Online Administrator” permission.

      Reply

Leave a Reply

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