Let's say I have this bit of code in Visual Studio 2010:

Visual Studio

If I open this in Notepad++ it looks like this:


See that argument2 it out of alignment.

It is not super clear, but in Notepad++ you can see that I am using spaces and not tabs and the font is Courier New (10 pt), which I believe is monospaced (incidentally I am using the "obsidian" style), but it seems like spaces are taking up less space than the characters (about half as much space if you count the dots under public. You can see that four of them cover only to the u).

So what am I missing here - does anyone know how I should configure Notepad++ to display my code aligned like Visual Studio does?

  • 1
    "Courier New" has serifs, and it looks like your font in Notepad++ has none. You can change the font in Settings->Style Configurator, select Default Style and set the font you want (also check if the font is set in any of the other styles in the list).
    – vstm
    Oct 2, 2012 at 14:45
  • 1
    @vstm serif or sans-serif does not matter;)
    – Christoph
    Oct 2, 2012 at 15:04
  • 2
    Your Notepad++ font is not Courier New.
    – BoltClock
    Oct 2, 2012 at 15:05
  • 1
    Use a monospace font and it will indent correctly. Oct 2, 2012 at 15:14

2 Answers 2


The font you currenty use is not monospaced, meaning the letters have different width. To achieve the effect you want, you need a monospaced font for that (it doesn't matter if it's a serif/sans-serif font).

Best (free) fonts for writing code are imo:


but you can just use Courier New, Consolas or any other monospaced font available on your system.

Settings->Style -> Font and then select the font you like.

  • 2
    The one seen in Visual Studio is Consolas. It also comes with Windows.
    – BoltClock
    Oct 2, 2012 at 15:05
  • @Bolt that's why i said available on your system, since Consolas in only available from Vista on;)
    – Christoph
    Oct 2, 2012 at 15:19
  • I missed that part. I'm tired ;)
    – BoltClock
    Oct 2, 2012 at 15:25
  • Take a nap and skip SO for today...enough rep for you;) Btw, I'm waiting for your Website Relaunch to come online for some time now;)
    – Christoph
    Oct 2, 2012 at 15:32

I will explain what the actual problem and solution were...

  • I had Courier New set as the Global Styles | Global Override option like so:


  • And I had Global Styles | Default Style set to Courier New also like so:

    Default style

  • In the C# area I had no explicit style selected like so:

    No style for c#

At this point I asked the question because I figured I was in Courier-New-monospace-land. Clearly I was not...

After a bit I thought, what the heck...I did the last thing remaining to me and went through every option in C# and set the font to Courier New like so:

C# explicit

And low and behold I had Courier New goodness, and it lined up!

Now, not to be someone who gives up I thought a bit longer about the actual options contained therein and rolled back to the situation where I had no explicit option set and then I set just the COMMENT option like so:

Just comment

And that was it!

It seems that for whatever reason the comment did not inherit its font (and a space is considered a comment) and therefore the indentation went all awry.

OK, now that's over I think I will go and have a look at Sublime Text or Vim...

  • 2
    Hey, I just had the same problem as you. The solution was to check the Enable global font right under the Font style frame in your first picture - that applies that font to everything which does not have other font set explicitly.
    – eudoxos
    Dec 4, 2013 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .