How Many Spaces in a Tab?

I always wonder, what if there was no tab key on the keyboard, how the world would have been? I pity on those people who don’t know about this wonder key and still use spacebar to beautify their work. So, now you recognized the power and wondering how many spaces are there in a tab? Let’s go into details.

First of all, a tab is a character just like any other characters on your keyboard. However, its behavior varies based on the application you are working on.

A standard tab character takes width of 8 characters when you print it on Command Prompt, Windows Notepad. However, when you hit this key on Eclipse, Notepad++, it takes width of 4 character long.

In most of the programming languages, we use slash-t written as “\t ” to print a tab character on the console. It is one among many of the escape sequences that are available.

In some applications, a Tab key performs an action, for example, in Excel if you press tab key, it doesn’t print anything on the sheet, however it jumps from one cell to another cell. If you press a tab key on web form also, it will jump from one text box to another text box.

The beauty of tab character is, you can write a table in a notepad separating the columns using the tab character, then copy these contents and paste it into an excel file. Excel automatically recognizes the tab character and puts all those columns of the table into individual excel columns.

Leave a Comment