I currently had Classic Experience set to all site collections on SharePoint Online, however this morning it has changed all to modern experience for lists and libary.
I would like to know what is best way to revert it back to Classic Experience.
Sooner or later, you need to adapt to SharePoint modern. I heard that by this year end the classic UI will go away from SharePoint Online product (just the news I heard, not making a statement or confirming it here, although a good topic to discuss).
For now, to turn off modern UI on all list and library, you need to activate the Site Collection feature
called SharePoint Lists and Libraries experience
in all site collections. You can use PowerShell to automate this process.
Read this article to know more.
Update: 6/19
Use the following PowerShell script to enable this feature in all site collections. Note, if you want to skip some site collection, update the line 4 to get desired site collection only. Also, you'll need tenant admin credentials to discover all the site collections in your tenant, and that account need to be part of site collection admin on all site collection where you want to perform this action. You can change script, to discover all the site collection using tenant admin account and then use site collection admin accounts to connect to individual site collection.
$cred = Get-Credential -UserName admin@tenant_Name.onmicrosoft.com -Message "SPO Admin Login"
Connect-PnPOnline https://<tenant_Name>-admin.sharepoint.com/ -Credentials
$siteColls = Get-PnPTenantSite
$siteColls | ForEach-Object {
Connect-PnPOnline -Url $_.Url -Credentials $cred
Enable-PnPFeature -Scope Site -Identity "e3540c7d-6bea-403c-a224-1a12eafee4c4" -Force -ErrorAction SilentlyContinue
}