Skip to main content
ansicode

TBC — Tab Clear (CSI g)

Clear one or all tab stops, changing where HT and CBT land.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[g (clear current) \x1b[3g (clear all)
\\033[\033[g / \033[3g
\\e[\e[g / \e[3g
ESC [ESC [ Ps g
hex1b 5b <Ps> 67

Description

Tabulation Clear. Final byte `g` (0x67); the parameter selects scope: `0` (default, also when omitted) = clear the tab stop AT the current column, `3` = clear ALL tab stops. Pair with HTS (`\x1bH`, ESC H) which SETS a tab stop at the current column. Default tab stops sit every 8 columns; once you `\x1b[3g` them all, HT (`\t`) does nothing until you set new ones. This matters for tabular CLI output (`column`, `pr`, `expand`), forms-style TUIs, and any app emitting `\t` for layout — clear the default 8-column grid, then place HTS stops at the actual field boundaries.

Spec citation: ECMA-48 §8.3.154 (TBC)

Parameters

0clear tab stop at current column
3clear ALL tab stops

Examples

bash
printf '\033[3g'      # clear all tab stops\nprintf '\033H'        # set a tab stop here (HTS, ESC H)
python
import sys; sys.stdout.write('\x1b[3g')
go
fmt.Print("\x1b[3g")
javascript
process.stdout.write('\x1b[3g')
c
printf("\x1b[3g");

Terminal support

xterm
yes
Linux console (fbcon)
yes
macOS Terminal.app
yes
iTerm2
yes
Windows Terminal
yes
cmd.exe / ConPTY
partial
kitty
yes
alacritty
yes
WezTerm
yes
Ghostty
yes
GNOME Terminal
yes
Konsole
yes
tmux
no
GNU screen
no

Related sequences

In the family cookbook

ESC cookbook · 2. Tab stops — `\x1bH` (HTS) sets, `\x1b[g` (TBC) clears