# Pad

### What It Does

Adds characters to the beginning or end of a string until it reaches the desired length. This is useful for aligning text, creating fixed-width formats, or visual styling.

### Inputs

| Name      | Description                             | Type   | Required |
| --------- | --------------------------------------- | ------ | -------- |
| string    | The text to pad                         | String | Yes      |
| length    | The target length for the padded string | Number | Yes      |
| character | The character to pad with               | String | Yes      |
| position  | Where to add padding (start or end)     | String | No       |

### Outputs

| Name   | Description     | Type   |
| ------ | --------------- | ------ |
| string | The padded text | String |

<figure><img src="https://3657049418-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy0SFXZjN1sdgdxYM7QPE%2Fuploads%2FQRqDVaTEZdaXOoXXxSVs%2FCleanShot%202025-04-03%20at%2015.32.04%402x.png?alt=media&#x26;token=841d34e4-ed26-4fb5-a4f7-507a1bda27e2" alt=""><figcaption></figcaption></figure>

### How to Use It

1. Drag the Pad node into your graph.
2. Connect the text you want to pad to the "string" input. For e.g., `name`.
3. Set the desired "length" for the final string. For e.g., `10`.
4. Specify the "character" to use for padding (only the first character will be used).
5. Select the "position" to add padding (start or end).

<figure><img src="https://3657049418-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy0SFXZjN1sdgdxYM7QPE%2Fuploads%2FLMqmkzVZNKFzwv5Yg7CQ%2FCleanShot%202025-04-03%20at%2015.31.34%402x.png?alt=media&#x26;token=bfc2a37c-5f89-4405-910e-13809665bf4e" alt=""><figcaption></figcaption></figure>

### Tips

* If your string is already longer than the specified length, it won't be truncated.
* Only the first character of the "character" input will be used for padding.

### See Also

* [**Case Convert**](https://documentation.tokens.studio/graph-engine/available-nodes/string/case-convert): For changing text case format.
* [**Normalize**](https://documentation.tokens.studio/graph-engine/available-nodes/string/normalize): For standardizing text representation.

### Use Cases

* **UI Display**: Create fixed-width elements for consistent visual alignment.
* **Code Formatting**: Format code identifiers with consistent spacing.
* **Data Export**: Prepare fixed-width fields for legacy systems or data exchange formats.
