---
schema_version: "1"
id: 1af74392938d0e86c887a58743c2f1fed790c28af93f470ef32e7373e160ea43
title: LPAD
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/string-func/lpad.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/lpad.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 45b1f185028b9e6a6ab633ef512161eed17430b173a9ce6199b3833c54777054
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `LPAD`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Prepends padding to a string on the left to a specified length.

## Syntax

```sql
lpad(<string>, <length> [, fill])
```

## Arguments

### Required

- `<string>`: The string to pad.
- `<length>`: The desired total length.

### Optional

- `fill`: The padding characters. Defaults to space.

## Returns

Returns a text value padded to the specified length.

## Considerations

- If the string is longer than the specified length, it is truncated on the right.
- The fill string is repeated as needed.

## Examples

### Left Pad

Pad a string on the left.

```sql
SELECT lpad('hi', 5, 'xy') AS result;
```

Returns `'xyxhi'`.

## Related Documentation

- [String Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
