CMD Simulator
System Informationcls

CLS Command – Clear the Command Prompt Screen in Windows

Learn how to use the CLS command to clear the Command Prompt window in Windows. Simple syntax, when to use it, and how it differs from closing or scrolling.

Rojan Acharya··Updated Mar 15, 2026
Share

The CLS command is a Windows Command Prompt utility that clears the display screen and leaves only the command prompt and cursor. Type CLS and press Enter to remove all previous output from the window—useful for starting a clean session, reducing clutter during demos, or after long command output.

Whether you're giving a presentation, debugging step-by-step, or simply keeping your CMD window tidy, CLS provides an instant way to clear the screen without closing the window or losing your current directory and environment.

This guide covers CLS syntax, when to use it, behavior in batch files, tips, and frequently asked questions.

What Is the CLS Command?

CLS (Clear Screen) has been part of Windows and MS-DOS for decades. It clears the visible content of the Command Prompt window so that the next command output appears at the top. It does not clear scrollback in all terminals; in standard CMD the scroll buffer may still contain previous output. It does not change the current directory, environment variables, or any running processes.

CLS works in Command Prompt (CMD), Windows Terminal (CMD profile), and is available in all Windows versions. It takes no parameters.

CLS Command Syntax

CLS

No parameters or switches. Running CLS clears the display and shows the prompt again.

Examples

Clear the screen

CLS

After execution, the window shows only the prompt (e.g. C:\Users\Name>). Previous output is cleared from the display.

Clear screen in a batch file

@ECHO OFF
ECHO Step 1: Checking disk...
CHKDSK C:
CLS
ECHO Step 2: Listing large files...
DIR /S /O-S C:\Data

Use CLS between phases to keep batch output readable or to present a clean screen before the next step.

Clear before running a command

CLS
DIR

Clears old output, then runs DIR so the listing starts at the top of the window.

Common Use Cases

  1. Presentations and demos – Clear the screen before each demo step.
  2. Debugging – Run a command, inspect output, then CLS and run again for a clean view.
  3. Batch scripts – Insert CLS between sections for clearer log-like output.
  4. Daily use – Keep the prompt window uncluttered without closing the session.

Tips and Best Practices

  1. CLS does not clear scrollback in all hosts – In some terminals you can still scroll up to see old output.
  2. No undo – Once cleared, previous output is gone from the display (unless your terminal keeps scrollback).
  3. Use in scripts – Place CLS after long-running steps to make the next section easier to read.
  4. Alternative in PowerShell – In PowerShell you can use Clear-Host or its alias cls for similar behavior.

Troubleshooting

Nothing happens when I run CLS

Some hosted or custom terminals may not support clearing. In standard CMD and Windows Terminal (CMD), CLS should clear the visible area. Try running in a new CMD window.

I want to keep the output before clearing

Redirect important command output to a file before clearing (e.g. DIR > list.txt then CLS). That way you still have the data.

Related Commands

  • ECHO – Display text; often used with CLS in scripts (e.g. CLS then ECHO Starting...).
  • EXIT – Close the Command Prompt window; use when you want to end the session, not just clear the screen.

Frequently Asked Questions

What does CLS do?

CLS clears the visible content of the Command Prompt window and leaves only the prompt. It does not change your current directory or environment.

Does CLS work in PowerShell?

PowerShell has its own clear command: Clear-Host. The alias cls in PowerShell runs Clear-Host, so typing cls there also clears the screen.

Can I undo CLS?

No. Clearing the display cannot be undone. If you need to keep output, redirect it to a file before running CLS.

Does CLS clear the scroll buffer?

In classic CMD, the scroll buffer may still contain previous output; only the visible area is cleared. Behavior can vary in Windows Terminal and other hosts.

Quick Reference Card

CommandPurpose
CLSClear the Command Prompt screen

Summary

CLS clears the Command Prompt screen so only the prompt remains. It has no parameters and is useful for demos, scripts, and keeping the window tidy. For ending the session, use EXIT; for saving output before clearing, use redirection (e.g. > file.txt).

Try CLS in the Windows Command Simulator. Browse the Commands Reference for more CMD utilities.