In C#, Console.WriteLine writes text to standard output and then ends the line. The next print starts on a new line.
Calling WriteLine() with no arguments prints only a blank line. Overloads accept strings, numbers, and composite format strings—the everyday tool for showing results in console apps.
This is a static member of System.Console. You call it with the type name, such as Console.WriteLine(...). Console is the everyday API for reading from standard input and writing to standard output in C# console apps.
Syntax
Pass a message, a value, a format string, or nothing for a blank line.
Write is the sibling that skips the newline. Both send text through Console.Out.
Library declarations
C#
public static void WriteLine();
public static void WriteLine(string? value);
public static void WriteLine(string format, params object?[]? arg);
// many overloads for common types
Parameters
Parameter
Description
(none)
Empty call prints only a newline.
value
Text or value to print before the newline.
format, arg
Composite format string and replacement values.
Return Value
Return Value
Description
void
Nothing is returned. Output goes to Console.Out.
C# Examples
Example 1 — Print Three Separate Lines
Each WriteLine ends with a newline so messages stack vertically.
C#
using System;
class Program {
static void Main() {
Console.WriteLine("Line 1");
Console.WriteLine("Line 2");
Console.WriteLine("Line 3");
}
}
Output
Line 1
Line 2
Line 3
How It Works
One call, one line. Each message appears on its own row.
Automatic newline. You do not type \\n yourself for the break.
Order matters. Calls run top to bottom in the order written.
Everyday output. This is the usual first method beginners learn.
Example 2 — Format a Score Line
Insert numbers into a sentence with placeholders.
C#
using System;
class Program {
static void Main() {
string player = "Sam";
int score = 120;
Console.WriteLine("{0} scored {1} points.", player, score);
}
}
Output
Sam scored 120 points.
How It Works
{0} and {1}. Placeholders map to the following arguments in order.
Readable sentence. Format keeps text and data in one string.
Types convert. The int is turned into text for display.
Ends the line. The period and newline finish the message.
Example 3 — Add Space With Empty WriteLine
Use a no-argument call to separate groups of output.
C#
using System;
class Program {
static void Main() {
Console.WriteLine("Header");
Console.WriteLine();
Console.WriteLine("Body text");
}
}
Output
Header
Body text
How It Works
Empty call.WriteLine() prints only the line ending.
Visual gap. A blank row appears between Header and Body text.
Grouping. Blank lines make sections easier to scan.
Still void. Like other WriteLine overloads, nothing is returned.
Frequently Asked Questions
It prints text (or nothing) and then moves to the next line on the console.
WriteLine adds a newline; Write does not.
Yes. Console.WriteLine() with no arguments prints a blank line.
Yes. Overloads accept many types, and format strings can mix text and values.
Learn Write for same-line prompts, then ReadLine for keyboard input.