C# Console Clear() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Console

Definition

In C#, Console.Clear erases the visible console content (the screen buffer area you see) and places the cursor at the upper-left corner.

Programs use it before redrawing a menu or starting a fresh “screen.” If output is redirected or the host has no interactive console, Clear may throw—keep that in mind for non-terminal environments.

This is a static member of System.Console. You call it with the type name, such as Console.Clear(...). Console is the everyday API for reading from standard input and writing to standard output in C# console apps.

Syntax

Call Console.Clear() with no arguments.

C#
Console.Clear();
CallWhat it does
Console.Clear()Clears the screen and homes the cursor.

Clear is console-window oriented. Redirected stdout may not support it.

Library declarations
C#
public static void Clear();

Parameters

ParameterDescription
NoneClear() takes no parameters.

Return Value

Return ValueDescription
voidNothing is returned; the display is updated.

C# Examples

Example 1 — Clear Then Print a Title

Wipe the console, then show a clean header.

C#
using System;

class Program {
    static void Main() {
        Console.WriteLine("Old text you will not see after Clear");
        Console.Clear();
        Console.WriteLine("Fresh start");
        Console.WriteLine("Menu ready");
    }
}

How It Works

  1. Old text gone. Clear removes what was on the screen.
  2. Home cursor. New writes begin at the top-left.
  3. Visible output. Only lines after Clear appear in sample output.
  4. UI reset. Handy before drawing a menu again.

Example 2 — Clear Between Menu Screens

Simulate two screens by clearing between messages.

C#
using System;

class Program {
    static void Main() {
        Console.WriteLine("=== Screen A ===");
        Console.WriteLine("Press Enter...");
        Console.ReadLine();
        Console.Clear();
        Console.WriteLine("=== Screen B ===");
        Console.WriteLine("Done");
    }
}

How It Works

  1. First screen. Title A shows until the user presses Enter.
  2. Sample Enter. Blank line in the narrative marks the empty ReadLine.
  3. Clear bridge. Screen A is wiped before Screen B prints.
  4. Second screen. Only the B messages remain visible afterward.

Example 3 — Refresh a Status Line

Clear and reprint so a status looks updated.

C#
using System;

class Program {
    static void Main() {
        for (int i = 1; i <= 3; i++) {
            Console.Clear();
            Console.WriteLine("Progress: step " + i + " of 3");
        }
        Console.WriteLine("Complete");
    }
}

How It Works

  1. Loop refresh. Each iteration clears before printing the new step.
  2. Last frame. sample output shows the final step text that remains.
  3. Complete line. Printed after the loop without another clear.
  4. Simple animation. Real apps may sleep between frames; this demo focuses on Clear.

Frequently Asked Questions

It clears the console screen buffer area and moves the cursor to (0, 0).
No. It only affects the console display, not disks or variables.
When there is no interactive console or the output is redirected in a way the host does not support.
No. Clear resets the buffer; newlines only scroll text.
Before redrawing menus or starting a clean visual section in a console UI.

Next: GetCursorPosition()

Return the current cursor left/top as a tuple (.NET 5+) with System.Console.

GetCursorPosition() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful