C# Console SetCursorPosition() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Console

Definition

In C#, Console.SetCursorPosition moves the cursor to a given column (left) and row (top) in the console buffer.

It enables overwriting text in place—progress counters, simple dashboards—without clearing the whole screen. Coordinates must be inside the buffer; invalid values throw. Redirected consoles may not support cursor moves.

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

Syntax

Pass zero-based left (column) and top (row).

C#
Console.SetCursorPosition(0, 0);
Console.SetCursorPosition(10, 2);
CallWhat it does
Console.SetCursorPosition(0, 0)Move to the upper-left of the buffer.
Console.SetCursorPosition(left, top)Move to a specific cell.

You can also assign Console.CursorLeft and Console.CursorTop. SetCursorPosition sets both together.

Library declarations
C#
public static void SetCursorPosition(int left, int top);

Parameters

ParameterDescription
leftColumn (0-based).
topRow (0-based).

Return Value

Return ValueDescription
voidCursor moves; nothing is returned.

C# Examples

Example 1 — Move Home and Overwrite

Write a line, jump to (0,0), then overwrite the start.

C#
using System;

class Program {
    static void Main() {
        Console.WriteLine("ABCDEF");
        Console.SetCursorPosition(0, 0);
        Console.Write("XX");
        Console.WriteLine();
    }
}

How It Works

  1. First line. ABCDEF is written normally.
  2. Jump home. SetCursorPosition(0,0) returns to the start.
  3. Overwrite. XX replaces the first two letters.
  4. Result. Remaining letters stay, producing XXCDEF.

Example 2 — Place Text at Column 10

Move sideways, then print a tag.

C#
using System;

class Program {
    static void Main() {
        Console.SetCursorPosition(10, 0);
        Console.WriteLine("Tag");
        Console.WriteLine("Next line starts at column 0");
    }
}

How It Works

  1. Column 10. Spaces in sample output show the indent.
  2. WriteLine. Prints Tag and advances to the next row.
  3. Next line. Starts at the left margin again.
  4. Layout tool. Useful for simple column layouts.

Example 3 — Update One Cell Repeatedly

Rewrite a single number without clearing the screen.

C#
using System;

class Program {
    static void Main() {
        Console.Write("Ticks: ");
        int left = Console.CursorLeft;
        int top = Console.CursorTop;
        for (int i = 0; i < 4; i++) {
            Console.SetCursorPosition(left, top);
            Console.Write(i);
        }
        Console.WriteLine();
    }
}

How It Works

  1. Remember cell. Save CursorLeft/Top after the label.
  2. Loop writes. Each digit overwrites the previous.
  3. Final 3. Last value remains visible.
  4. No full Clear. Only one character cell updates.

Frequently Asked Questions

Yes. (0,0) is the upper-left of the buffer.
ArgumentOutOfRangeException is thrown.
Often not. Cursor APIs expect an interactive console window.
Set moves the cursor; Get reads the current position (.NET 5+).
Yes by setting the same position and writing new text over the old.

Next: SetError()

Redirect Console standard error to a different TextWriter with System.Console.

SetError() 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.

9 people found this page helpful