How to print a blank line in C#?

To print a blank line in C#, you can use several methods. The most common approach is using Console.WriteLine() without any parameters, which outputs an empty line to the console.

Syntax

Following are the different ways to print a blank line −

Console.WriteLine();           // Empty line
Console.WriteLine("");         // Empty string
Console.WriteLine(" ");        // Single space
Console.Write("<br>");           // Newline character

Using Console.WriteLine() with No Parameters

The simplest and most efficient way to print a blank line is by calling Console.WriteLine() without any arguments −

using System;

public class Demo {
   public static void Main() {
      Console.WriteLine("First line");
      Console.WriteLine();
      Console.WriteLine("Third line - blank line above!");
   }
}

The output of the above code is −

First line

Third line - blank line above!

Using Console.WriteLine() with Empty String

You can also pass an empty string to achieve the same result −

using System;

public class Demo {
   public static void Main() {
      Console.WriteLine("Line 1");
      Console.WriteLine("");
      Console.WriteLine("Line 3");
   }
}

The output of the above code is −

Line 1

Line 3

Multiple Blank Lines

To print multiple blank lines, you can call Console.WriteLine() multiple times or use the newline character

using System;

public class Demo {
   public static void Main() {
      Console.WriteLine("Top line");
      Console.WriteLine();
      Console.WriteLine();
      Console.WriteLine("Bottom line");
      
      Console.WriteLine("Using newlines:");
      Console.WriteLine("First<br>\nThird");
   }
}

The output of the above code is −

Top line


Bottom line
Using newlines:
First

Third

Comparison of Methods

Method Description Performance
Console.WriteLine() Most common and readable Best performance
Console.WriteLine("") Passes empty string Slightly slower
Console.WriteLine(" ") Prints a space character Not truly blank
Console.Write("
")
Uses newline character Good for inline usage

Conclusion

The most efficient and readable way to print a blank line in C# is using Console.WriteLine() without any parameters. This method is preferred over passing empty strings or spaces as it clearly indicates the intention to print a blank line and offers the best performance.

Updated on: 2026-03-17T07:04:35+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements