How to Clear the Screen in PowerShell (cls, Clear-Host)

An hour of testing leaves the console buried in red errors, old tables and half-finished commands. You want a clean slate without closing the window.

Quick answer: to clear the screen in PowerShell, type cls (or clear, or Clear-Host) and press Enter. You can also press Ctrl+L at the prompt:

cls

In this tutorial, we’ll show every way to clear the screen in PowerShell, what happens to the scrollback, and the one place where Clear-Host breaks a script.

What You Need Before You Start

Any PowerShell works. We ran every example in PowerShell 7.6 and Windows PowerShell 5.1, so check your PowerShell version if you aren’t sure which one you have.

We tested in the classic console window (conhost) and in Windows Terminal. Our comparison of Windows Terminal and PowerShell explains how the two fit together.

Step 1: Clear the Screen With cls, clear or Clear-Host

All three names run the same command. cls and clear are just aliases, as this check shows:

Get-Alias -Name cls, clear | ForEach-Object { "$($_.Name) -> $($_.Definition)" }
$cmd = Get-Command -Name Clear-Host
"Clear-Host is a $($cmd.CommandType) with $($cmd.Parameters.Count) parameters"

Output:

cls -> Clear-Host
clear -> Clear-Host
Clear-Host is a Function with 0 parameters
cls and clear are aliases of the Clear-Host function in PowerShell 7
cls and clear both point to Clear-Host, a function with no parameters (PowerShell 7)

Both versions printed the same three lines. Clear-Host is one of the built-in PowerShell functions, not a compiled cmdlet, and it takes no parameters.

We even tried Clear-Host -Verbose, and both versions accepted it silently. On Linux and macOS, only cls is an alias, because clear runs the system’s own clear program there.

Step 2: Clear the Screen With Ctrl+L

Ctrl+L comes from PSReadLine, the module that handles typing at the prompt. Its ClearScreen function clears the screen and redraws your current line at the top, so a half-typed command survives:

$handler = Get-PSReadLineKeyHandler | Where-Object Key -eq 'Ctrl+l'
$version = (Get-Module -Name PSReadLine).Version
"PSReadLine $version binds $($handler.Key) to $($handler.Function)"

Output:

PSReadLine 2.4.5 binds Ctrl+l to ClearScreen
PSReadLine binds Ctrl+L to ClearScreen in Windows PowerShell 5.1
Windows PowerShell 5.1 ships PSReadLine 2.0.0, which still binds Ctrl+L to ClearScreen (Windows PowerShell 5.1)

The output above is from PowerShell 7, which loaded PSReadLine 2.4.5. Windows PowerShell 5.1 loaded 2.0.0, and both bind Ctrl+L the same way.

We filtered with Where-Object on purpose. PSReadLine 2.0.0 has no -Chord parameter, so Get-PSReadLineKeyHandler -Chord Ctrl+l fails in a stock 5.1 window.

Does Clear-Host Dele