Guide

How to Remove Tabs in Excel, Word and Code

Remove tab characters in Excel with SUBSTITUTE and CHAR(9), in Word with ^t, or in code with \t. See why a tab is not four spaces, with examples.

5 min read Updated Oct 2026

Quick Answer

Remove tabs to convert tabs to spaces: every tab character is replaced with a single space. To strip tab characters or detab text quickly, paste and convert. This tabs vs spaces swap keeps adjacent words clearly separated without gluing them together, and it is handy right after a spreadsheet paste drops tab-separated cells into your text.

Try Remove Tabs →

Why Tabs Cause Trouble

Why do tabs cause alignment problems? Tabs are single characters that render as variable width, and their width changes from one program to another, so text that looks aligned in one editor falls apart in another. A tab is not the same as several spaces: it is one character the display stretches, not a fixed run. Tabs also clash with tools and formats that expect spaces: pasting tab-indented code into a spaces-only project, or feeding tab-separated text into a parser that wants single spaces.

How It Works

The tool finds every tab character in your text and swaps it for a single space, leaving all other characters and your line breaks untouched. For example, a tab-separated list like "Name\tEmail\tCity" becomes "Name Email City": each tab replaced with one space, so fields remain clearly separated.

This tool is free and runs online entirely in your browser. Your text stays on your device, protecting your privacy: what you enter is not sent to a server, and results appear instantly.

Examples

A spreadsheet paste. For example, "Name\tEmail\tCity" pasted from a sheet becomes "Name Email City", so the columns read as plain words.

Mixed indentation. For example, a line that begins with a tab loses the tab for one space, which is why you often run Remove Extra Spaces next to tidy the result.

How Do You Remove Tabs in Excel or Google Sheets?

In Excel or Google Sheets, wrap the cell in SUBSTITUTE and swap character 9 for a space: =SUBSTITUTE(A1,CHAR(9)," "). CHAR(9) is the tab character, so the formula replaces every tab in A1 and leaves the rest of the text alone. Fill it down the column, then paste the results back as values.

TRIM will not do this job. It only removes the ordinary space character, so a tab inside a cell survives it. CLEAN does delete tabs, but it deletes them outright: "Name[tab]Email" becomes "NameEmail", with the two words glued together. That is why SUBSTITUTE with a space is the safer default.

How Do You Remove Tabs in Word?

In Word, open Replace with Ctrl+H, type ^t in Find what, and type a single space in Replace with. ^t is Word's code for a tab character. Click Replace All and every tab in the document becomes one space.

If you forget the code, expand the dialog and pick Tab Character from the Special menu. This removes tab characters only. Tab stops set on the ruler stay in place, so any tabs you type later still jump to them.

How Do You Remove Tabs in Code or a Regex Editor?

In code, a tab is \t. In JavaScript, text.replace(/\t/g, ' ') swaps each one for a space. In Python, text.replace('\t', ' ') does the same. Any regex-aware editor accepts \t in its search box with regex mode on.

For indentation, use the editor's own command instead, such as VS Code's "Convert Indentation to Spaces". It knows your tab width. That matters because a tab is not four spaces: it moves the cursor to the next tab stop. In Python, "a\tb".expandtabs(4) gives "a" plus three spaces plus "b", because the "a" already filled one column of four.

Common Mistakes

Remove Tabs vs Other Whitespace Tools

Remove Tabs only swaps tabs for spaces: Remove Extra Spaces then collapses the runs it leaves, and Normalize Whitespace handles tabs, spaces and line breaks in one pass. For indented code, use your editor's conversion so each tab becomes the right number of spaces.

You May Also Need

You may also need

Alternatives

  • Trim TextOnly strip edge whitespace, leaving inner tabs

Continue Learning