STRING-PAD(1) fish-shell STRING-PAD(1)

# [NAME](#NAME)

string-pad - pad strings to a fixed width

# [SYNOPSIS](#SYNOPSIS)

```
string pad [-r | --right] [-C | --center] [(-c | --char) CHAR] [(-w | --width) INTEGER]


           [STRING ...]
```

# [DESCRIPTION](#DESCRIPTION)

**string pad** extends each *STRING* to the given visible width by adding *CHAR* to the left. That means the width of all visible characters added together, excluding escape sequences and accounting for **fish\_emoji\_width** &lt;#envvar-fish\_emoji\_width&gt; and **fish\_ambiguous\_width** &lt;#envvar-fish\_ambiguous\_width&gt;. It is the amount of columns in a terminal the *STRING* occupies.

The escape sequences reflect what fish knows about, and how it computes its output. Your terminal might support more escapes, or not support escape sequences that fish knows about.

If **-C** or **--center** is given, add the padding to before and after the string. If it is impossible to perfectly center the result (because the required amount of padding is an odd number), extra padding will be added to the left, unless **--right** is also given.

If **-r** or **--right** is given, add the padding after a string.

If **-c** or **--char** is given, pad with *CHAR* instead of whitespace.

The output is padded to the maximum width of all input strings. If **-w** or **--width** is given, use at least that.

# [EXAMPLES](#EXAMPLES)

```
>_ string pad -w 10 abc abcdef


       abc


    abcdef
>_ string pad --right --char=🐟 "fish are pretty" "rich. "
fish are pretty
rich.  🐟🐟🐟🐟
>_ string pad -w$COLUMNS (date)
# Prints the current time on the right edge of the screen.
```

# [SEE ALSO](#SEE_ALSO)

- The printf &lt;&gt; command can do simple padding, for example **printf %10s\\n** works like **string pad -w10**.
- string length &lt;&gt; with the **--visible** option can be used to show what fish thinks the width is.

# [Copyright](#Copyright)

fish-shell developers

October 15, 2026 4.9

---

Document: string-pad(1) from fish 4.9.3-r3 (Chainguard OS)
Source: https://github.com/fish-shell/fish-shell
