Skip to content
masterclass Buddy

Cypress · Method

cy.clearLocalStorage

Clears localStorage for the current origin. You can clear everything or only keys that match a string or regular expression.

Last updated

Syntax

cy.clearLocalStorage()
cy.clearLocalStorage(key)
cy.clearLocalStorage(options)
cy.clearLocalStorage(key, options)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • cy.clearAllLocalStorage()
  • cy.clearAllCookies()
  • cy.clearAllSessionStorage()

Source: cy.clearLocalStorage() | Cypress API Documentation. Checked 2026-11-03.