---
id: api/commands/clearallcookies
title: cy.clearAllCookies()
description: Clear all browser cookies across every domain in Cypress.
section: api
source_path: docs/api/commands/clearallcookies.mdx
version: fc1f08bb3d8dafec7ab66b956c3d6168d5764c4f
updated_at: '2026-09-28T07:38:10.900Z'
---
# clearAllCookies

Clear all browser cookies across every domain.

While [`cy.clearCookies()`](/llm/markdown/api/commands/clearcookies.md) clears cookies for a single domain, `cy.clearAllCookies()` doesn't read the current URL, so it works without [`cy.origin()`](/llm/markdown/api/commands/origin.md) even after your app navigates to another origin.

Cypress automatically clears all cookies _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 all cookies inside a single test or test isolation is disabled.

## Syntax

```
cy.clearAllCookies()
cy.clearAllCookies(options)
```

### Usage

**Correct Usage**

```
cy.clearAllCookies() // Clear all cookies
```

### Arguments

**options _(Object)_**

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

| Option | Default | Description |
| --- | --- | --- |
| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |
| `timeout` | [`responseTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `cy.clearAllCookies()` to resolve before [timing out](#Timeouts) |

### Yields

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

## Examples

### No Args

#### Clear cookies set by multiple domains[

End-to-End Only

](/llm/markdown/app/core-concepts/testing-types.md#What-is-E2E-Testing)

In this example, logging in through an identity provider sets cookies on both the identity provider's domain and your app's domain. `cy.clearAllCookies()` clears the cookies from both in one command.

```
cy.contains('Log in').click()
cy.origin('https://example.cypress.io', () => {
  cy.get('[type=password]').type('*****')
  cy.contains('Log in').click()
})
cy.url().should('include', 'profile')
cy.getAllCookies().should('have.length', 2)
cy.clearAllCookies()
cy.getAllCookies().should('be.empty')
```

#### Log out in the middle of a test[

End-to-End Only

](/llm/markdown/app/core-concepts/testing-types.md#What-is-E2E-Testing)

Clearing every cookie removes your app's session cookie along with any cookies the identity provider set, so the next request arrives logged out. In this example, the app redirects unauthenticated visitors to its login page.

```
cy.visit('/dashboard')
cy.clearAllCookies()
cy.reload()
cy.url().should('include', 'login')
```

#### Clear cookies before each test when test isolation is off[

End-to-End Only

](/llm/markdown/app/core-concepts/testing-types.md#What-is-E2E-Testing)

With [test isolation](/llm/markdown/app/core-concepts/test-isolation.md) turned off, cookies from one test carry over to the next. Call `cy.clearAllCookies()` in a `beforeEach` hook to start every test in the suite without cookies.

```
describe('Account settings', { testIsolation: false }, () => {
  beforeEach(() => {
    cy.clearAllCookies()
  })

  it('shows the login prompt', () => {
    // no cookies from earlier tests are present
  })
})
```

### Options

#### Clear cookies without logging to the Command Log

Pass `{ log: false }` to keep `cy.clearAllCookies()` out of the [Command Log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log), which is useful when it runs in a hook before every test.

```
cy.clearAllCookies({ log: false })
```

## Rules

### Requirements

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

### Assertions

*   `cy.clearAllCookies()` yields `null`, so there's nothing to assert on. To confirm the cookies are cleared, assert on [`cy.getAllCookies()`](/llm/markdown/api/commands/getallcookies.md) afterward, for example `cy.getAllCookies().should('be.empty')`.

### Timeouts

*   `cy.clearAllCookies()` can time out waiting for the browser to clear the cookies. It waits up to the [`responseTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) (or the `timeout` option, when passed) before failing.

## History

| Version | Changes |
| --- | --- |
| [12.1.0](/llm/markdown/app/references/changelog.md#12-1-0) | `cy.clearAllCookies()` command added |

## See also

*   [`cy.clearCookie()`](/llm/markdown/api/commands/clearcookie.md)
*   [`cy.clearCookies()`](/llm/markdown/api/commands/clearcookies.md)
*   [`cy.getAllCookies()`](/llm/markdown/api/commands/getallcookies.md)
*   [`cy.getCookie()`](/llm/markdown/api/commands/getcookie.md)
*   [`cy.getCookies()`](/llm/markdown/api/commands/getcookies.md)
*   [`cy.setCookie()`](/llm/markdown/api/commands/setcookie.md)
*   [`Cypress.Cookies.debug()`](/llm/markdown/api/cypress-api/cookies.md)
