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.
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
Parameter
Description
left
Column (0-based).
top
Row (0-based).
Return Value
Return Value
Description
void
Cursor 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();
}
}
Output
XXCDEF
How It Works
First line. ABCDEF is written normally.
Jump home. SetCursorPosition(0,0) returns to the start.
Overwrite. XX replaces the first two letters.
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");
}
}
Output
Tag
Next line starts at column 0
How It Works
Column 10. Spaces in sample output show the indent.
WriteLine. Prints Tag and advances to the next row.
Next line. Starts at the left margin again.
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();
}
}
Output
Ticks: 3
How It Works
Remember cell. Save CursorLeft/Top after the label.
Loop writes. Each digit overwrites the previous.
Final 3. Last value remains visible.
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.