---
id: api/commands/clearalllocalstorage
title: cy.clearAllLocalStorage()
description: Clear all localStorage data in Cypress.
section: api
source_path: docs/api/commands/clearalllocalstorage.mdx
version: 3163d68b20e695f2c76d40c85c3f3b956dd19a3b
updated_at: '2026-08-21T20:59:04.402Z'
---
# clearAllLocalStorage

Clear [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) data for all origins with which the test has interacted.

Cypress automatically clears all local storage _before_ each test to prevent state from being shared across tests when [test isolation](/llm/markdown/app/core-concepts/writing-and-organizing-tests.md#Test-Isolation) is enabled. You shouldn't need to use this command unless you're using it to clear localStorage inside a single test or test isolation is disabled.

## Syntax

```
cy.clearAllLocalStorage()
cy.clearAllLocalStorage(options)
```

### Usage

**Correct Usage**

```
cy.clearAllLocalStorage()
```

### Arguments

**options _(Object)_**

Pass in an options object to change the default behavior of `cy.clearAllLocalStorage()`.

| Option | Default | Description |
| --- | --- | --- |
| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |

### Yields

*   `cy.clearAllLocalStorage()` yields `null`.

## Rules

### Requirements

*   `cy.clearAllLocalStorage()` requires being chained off of `cy`.

### Assertions

*   `cy.clearAllLocalStorage()` cannot have any assertions chained.

### Timeouts

*   `cy.clearAllLocalStorage()` cannot time out.

## See also

*   [`cy.clearAllSessionStorage()`](/llm/markdown/api/commands/clearallsessionstorage.md)
*   [`cy.clearCookies()`](/llm/markdown/api/commands/clearcookies.md)
*   [`cy.clearLocalStorage()`](/llm/markdown/api/commands/clearlocalstorage.md)
*   [`cy.getAllLocalStorage()`](/llm/markdown/api/commands/getalllocalstorage.md)
*   [`cy.getAllSessionStorage()`](/llm/markdown/api/commands/getallsessionstorage.md)
