Skip to main content
ansicode

SGR 1 — Bold / Increased intensity

Render following text in bold (or bright on some terminals).

Byte forms

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

\\x1b[\x1b[1m
\\033[\033[1m
\\e[\e[1m
ESC [ESC [ 1 m
hex1b 5b 31 6d

Live preview

Rendered in your browser via the same tokeniser the decoder uses — no terminal needed.

Bold weight

Description

Turns on bold weight on most modern terminals — xterm, iTerm2, kitty, alacritty, wezterm, Windows Terminal, gnome-terminal and konsole all render bold by switching the font to the bold variant of whatever face is currently active (so the user's font choice decides what 'bold' looks like; some monospace faces ship a poor bold and users disable it via their terminal config).

The historical wrinkle is bold-as-bright: on the Linux console / fbcon and on some retro emulators using VGA-style fonts, there is no bold glyph file at all, so SGR 1 instead brightens the current foreground color, mapping color N (30–37) to its bright variant N+8 (90–97). The same color promotion is what xterm does when its boldColors X resource is on and when a bold color isn't otherwise specified. The practical effect: code that emits \x1b[1;31mERROR will look red-bold on iTerm2 but bright-red (no weight change) on a Raspberry Pi tty. ConPTY / legacy cmd.exe also fall back to bright. If you need 'bold weight, exact red', spell the bright color explicitly (\x1b[1;91mERROR) — it's idempotent under both interpretations.

To turn bold off without clearing other attributes, emit \x1b[22m (SGR 22 — normal intensity, which also clears sgr-dim SGR 2). Do not use \x1b[21m for 'bold off' — its original ECMA-48 meaning is 'doubly underlined' (see sgr-double-underline); only a handful of terminals overload it for bold disable, and the conflict will bite cross-terminal. The clean pattern is \x1b[1m…\x1b[22m for surgical bold, or \x1b[1m…\x1b[0m if you're also closing color/other state.

Spec citation: ECMA-48 §8.3.117 (SGR parameter 1)

Examples

bash
printf '\033[1mbold\033[22m normal\033[0m\n'
python
print('\x1b[1mbold\x1b[0m')
go
fmt.Print("\x1b[1mbold\x1b[0m")
javascript
console.log('\x1b[1mbold\x1b[0m')
c
printf("\x1b[1mbold\x1b[0m\n");

Used in

Real-world tools that emit this sequence — anchors the bytes to commands you've already used.

  • git log, git statusref names, branch labels, commit subject prefixes
  • gcc, clangfile:line: prefix on each diagnostic
  • man pages (NAME, SYNOPSIS headings)
  • npm, pnpm package names in tree output
  • brew install summaries

Frequently asked

Short answers to the questions developers actually search for this sequence.

Does \x1b[22m cancel \x1b[1m?
Yes. \x1b[22m is the surgical 'normal intensity' disable — it clears bold and dim simultaneously (ECMA-48 ties the two together) without touching colour, italic, underline, or any other attribute. Use it instead of \x1b[0m when you only want to drop the weight.
Why does my bold red text turn into bright red on some terminals?
Legacy xterm behaviour: when bold is combined with a basic 30–37 colour, many terminals (xterm, macOS Terminal, gnome-terminal default profile, Linux console) render the colour from the bright 90–97 slot instead of bolding the glyph. Modern terminals (iTerm2, kitty, alacritty, ghostty, Windows Terminal) honour both bold weight AND the colour. If you want strictly bold-without-brightening, emit \x1b[1;91m directly so the bright colour is requested explicitly.

Terminal support

xterm
yes
Linux console (fbcon)
partial
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
yes
GNU screen
yes

Related sequences