---
title: console.clear()
slug: Web/API/console/clear
tags:
  - API
  - Debugging
  - Method
  - Reference
  - console
  - web console
browser-compat: api.console.clear
---
{{APIRef("Console API")}}

The **`console.clear()`** method clears the console if the
environment allows it.

## Syntax

```js
console.clear();
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
