By josh / January 25, 2014

How to show whitespace in Sublime Text

There’s one every team: That one guy who’s taken the wrong side in the eternal Tabs vs. Space Debate.

Perhaps he doesn’t know any better. It’s possible he just hasn’t bothered to set up his text editor.

Or maybe, you suspect darkly, he knows and does it on purpose…

Whatever the reason, his commits are a pain to review. And editing files he’s touched makes you grind your teeth. Especially when the inconsistencies are on the same line. Like, four spaces, tab, four spaces. Nerdrage!!!

While Sublime can’t dish out the attitude adjustment this guy so justly deserves, it can make it easy to spot (and fix) inconsistent use of whitespace in files.

By default, Sublime shows whitespace on selected text:


Tabs show up as dashes, while spaces are dots.

You can control when Sublime shows white space with the draw_white_space setting. The default value is selection, but you can override that with all to always show whitespace or none to never show it.

To change your whitespace preferences, run Preferences: Settings – User in the command palette, then add the draw_white_space setting:

    "draw_white_space": "all"

If you also want Sublime to automatically replace tab characters with spaces when you open a file, override the translate_tabs_to_spaces setting:

    "draw_white_space": "all",
    "translate_tabs_to_spaces": true

P.S. Don’t miss your chance to get more done with Sublime! Sign up for my free Sublime Text Tips newsletter to get more tips every week. As a bonus, I’ll send you a FREE 12-page guide to Sublime’s advanced editing features so you can start using Sublime more effectively–today.

About the author


Travis Spencer - April 10, 2016

It would be helpful with a third option — if the current file contains a mix of tabs and spaces (i.e., uses whitespace inconsistently), automatically make whitespace visible. Otherwise, you may not notice it till later. Does ST support this by chance?

Click here to add a comment

Leave a comment: