From Notepad++ Wiki
Jump to: navigation, search
Managing horizontal spacing, aka blanks or whitespace

In either normal text or source code, words or expressions are separated by white space, using either the space (ASCII 0x20) or tab (ASCII 0x09, aka \t) character.


The Edit -> Blank operations submenu gathers commands that help managing the white space, mostly inside text. Settings that concern Indentation are covered on that page, even though indentation is done using whitespace.

Leading and trailing space can be trimmed using Edit -> Blank operations → Trim trailing spaces. This can be done to the leading space, or bth sides, using similarly named entries. These commands operate on the whole document no matter the selection(s).

Edit -> Blank operations → EOL to Space will turn each line end into a space. Edit -> Blank operations → Remove Unnecessary Blank and EOL similarly remves excess whitespace.

Edit -> Blank operations → TAB to Space and Edit -> Blank operations → Space to TAB (All) will convert tabs to spaces and back in a whole document, using the tab to space ratio for the current lexer. Spaces are converted to tabs as follows:

  • spaces up to the next multiple of the space factor are turned to a tab;
  • Each of the following chunks of n spaces is turned into a tab, where n is the tab to space factor;
  • Any leftover is tirned into an extra tab.

You can choose to convert leading spaces only to TABs by using the Edit -> Blank operations → Space to TAB (Leading) variant.


The View -> View Symbol → Show White Space and TAB toggle menu item turns display of whitespace on and off. Tabs show as arrows pointing right, the size being the number of spaces replaced. Spaces show as small dots. The colour for both can be set from the Styler Configurator, Global styles, White space symbol. The background colour is ignored. The size is supposedly adjustable too.

Other whitespace related commands

The TextFX plugin provides TextFX Characters -> Zap all characters to space that quickly blanks the selection out.