---
schema_version: "1"
id: e864ed2243ebce935b0f341a89e5ac63e4b77251726b9b1b53960b8b9d2b3c95
title: LPAD
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/customize_functions_lpad.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.customize_functions_lpad.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 2ea9c0410392e55f750ecc4fcd7b8dd1720c9d7b3f4ef13020341a7964754200
description: Inserts characters you specify to the left-side of a text string.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# LPAD

Inserts characters you specify to the left-side of a text string.

## Use

`LPAD(text, padded_length[, pad_string])` and replace the variables:

- text is the field or expression you want to insert characters to the left of.
- padded\_length is the number of total characters in the text that’s returned.
- pad\_string is the character or characters that are inserted. pad\_string is optional and defaults to a blank space.

If the value in text is longer than pad\_string, text is truncated to the size of padded\_length.

## Tips

Leading blank spaces and zeros are omitted.

![Field Name Example: Padding](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Field Name Example: Padding

`LPAD(Name, 20)` truncates the Name field after 20 characters. For example, if the name is `mycompany.com`, the value returned is "mycompany.com."

![My Company Example: No Change](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

My Company Example: No Change

`LPAD('my_company.com', 14, 'z')` returns “my\_company.com” without change because it has 14 characters.

![Field Name Example: Padded with Z](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Field Name Example: Padded with Z

`LPAD(Name, 15, 'z')` returns the name “zmycompany.com.”

![Field Name Example: Truncating Ex](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Field Name Example: Truncating Ex

`LPAD(Name, 2)` truncates the name after the second character. For example, if the name is `mycompany.com`, the value returned is “my.”