# leftPad() and rightPad() in Jira Automation

URL: https://goingstellar.ro/reference/smart-values/leftpad-rightpad/

leftPad(n, pad) adds the pad text at the start until the whole text is n characters long, and rightPad(n, pad) adds it at the end. Use them for zero-filled numbers, aligned columns in a plain-text message, or fixed-width reference codes.

## Syntax

```
{{issue.summary.leftPad(14, "-")}}
{{issue.summary.rightPad(14, "-")}}
```

## Arguments

- `length` (required: yes): Total number of characters wanted
- `pad` (required: yes): The text used for padding, in straight double quotes

## Works on

- Fields: text smart values
- Returns: text

## Examples

```
{{issue.key.substringAfter("-").leftPad(5, "0")}}
```

Turn the number of an issue key into a five-digit code. For WEB-43 the result is 00043.

Result:

```
00043
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.leftPad(14, "-")}}
```

Right-align a short title in a 14 character column. With a summary of Hello World! two characters of padding are added.

Result:

```
--Hello World!
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.rightPad(14, "-")}}
```

Pad on the right to build a plain-text table whose columns line up.

Result:

```
Hello World!--
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.rightPad(20, ".")}}
```

A dotted leader, as in a table of contents.

Result:

```
Hello World!........
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.key.substringBefore("-").rightPad(6, "_")}}
```

Fill the project part of a key to a fixed width.

Result:

```
WEB___
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.key.rightPad(10, "ab")}}
```

A pad of several characters repeats and is cut at the target length.

Result:

```
WEB-43abab
```

Run on Jira Cloud on 29 Nov 2026.

## Where the documentation differs

- `{{issue.summary.<br/>rightPadPad(14,"-")}}`: run on Jira Cloud, 29 Nov 2026: the documentation says `Hello World!--`, the actual result is ``.

## Pitfalls

- The rightPad example in the Atlassian documentation contains an HTML line break and a misspelt function name (`rightPadPad`). Copied as written it renders an empty text, and `rightPadPad(14,"-")` without the tag does the same (checked on Jira Cloud, November 2026). Type `rightPad`.
- A text that is already as long as the target, or longer, is returned unchanged. Padding never shortens or cuts.
- Calling leftPad() without the pad argument renders an empty text instead of an error, so a missing second argument looks like a missing value.

## Related

- [length()](https://goingstellar.ro/reference/smart-values/length/)
- [substringAfter(), substringBefore(), substringBetween()](https://goingstellar.ro/reference/smart-values/substringafter-substringbefore/)
- [concat()](https://goingstellar.ro/reference/smart-values/concat/)
- [format() and formatWithLocale()](https://goingstellar.ro/reference/smart-values/number-format/)
- [left() and right()](https://goingstellar.ro/reference/smart-values/left-right/)
- [trim()](https://goingstellar.ro/reference/smart-values/trim/)

## Sources

- [Jira smart values: text fields (Atlassian Support)](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/)

