Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
DictionaryLLength
Core CRMAdvanced

Length

Length in Salesforce is the field attribute that defines the maximum number of characters or digits a field can store.

§ 01

Definition

Length in Salesforce is the field attribute that defines the maximum number of characters or digits a field can store. It appears on every Text, Long Text Area, Rich Text Area, Number, Currency, Percent, Phone, Email, URL, and similar field types. The Length setting is the foundational sizing decision that admins make when creating a custom field; it directly affects validation, integration, search indexing, and storage. Once a field is created, Length can be increased without data loss but rarely decreased without risk of truncation.

Beyond the field-level meaning, Length also surfaces as a function in formulas (LEN() returns the character count of a string) and as an attribute of the standard fields. The standard Account.Name field has a length of 255, Opportunity.Name 120, Contact.LastName 80; integrations and Apex code must respect these limits or face DML exceptions. The Length attribute also drives field-type display: Text fields above 255 characters become Long Text Areas, which behave differently for search, formulas, and report filtering. Understanding the Length implications of each field type is the foundation of good Salesforce data modeling.

§ 02

How field Length shapes the Salesforce data model

Text field Length and field-type boundaries

Text fields support length 1-255 characters. Above 255, the platform requires Long Text Area (max 131,072 characters) or Rich Text Area. The 255 boundary matters: Text is searchable, indexable, and usable in formulas; Long Text Area is none of those by default. Admins making a length decision are also choosing the field''s search and formula behavior.

Number, Currency, and Percent precision

Numeric fields define both Length (total digits) and Decimal Places. A field with Length 10 and Decimal Places 2 supports values from -99,999,999.99 to 99,999,999.99. Currency and Percent follow the same model. Picking the wrong precision causes silent data truncation; pick generous numbers up front to avoid migration headaches.

Increasing Length is safe; decreasing is risky

Salesforce supports increasing a field''s Length without data loss. Decreasing requires that no existing values exceed the new shorter length; the platform validates this at save time and blocks the change if any row would truncate. Production decreases require a data audit and usually a migration script to either shorten or relocate the offending values.

Standard field lengths

Standard fields have fixed lengths that cannot be changed. Account.Name is 255; Opportunity.Name is 120; Contact.LastName is 80; Lead.Email is 80. Integration code, Apex, and Flow must respect these limits, or DML throws STRING_TOO_LONG. The Salesforce Object Reference documents every standard field''s length; consult it during integration design.

Length in formulas

The LEN(text) formula function returns the character count of a string. Use it in validation rules (block records where Description LEN exceeds 1000) and in formula fields (compute display strings based on input length). LEN counts characters, not bytes, so multibyte characters (Unicode) count as one each. Performance is fine for short strings; very long strings still take noticeable formula CPU.

Search and indexing implications

Text fields up to 255 characters are full-text indexed. Long Text Areas above 255 are not indexed by default; admins must explicitly enable Long Text indexing per object. Without indexing, searching against a Long Text field is slow and limited. The Length choice often shapes the search experience indirectly.

External ID and unique fields

External ID fields and Unique fields have their own length considerations. External IDs are typically Text fields, often Length 18 (matching the Salesforce ID) or 36 (matching a UUID). Unique fields enforce uniqueness across the object; lengths chosen too small risk collisions when external systems concatenate identifiers.

§ 03

Pick the right Length for a new custom field

Length is a one-line decision that has long-term consequences. Spend the few minutes to size it right at field-creation time.

  1. Identify the data source

    Where does this field''s data come from? Customer input? External system? Computed value? Each source has typical lengths to design for.

  2. Pick a generous initial length

    Increasing later is free; decreasing is painful. Default to a length comfortably above the expected maximum.

  3. Cross-check against standard field limits

    If the field maps to a standard field downstream, match or undercut its length. Don''t make a custom Name longer than Account.Name (255).

  4. Choose Text vs. Long Text Area deliberately

    The 255 boundary is meaningful. Text is searchable and formula-friendly; Long Text Area is not. Pick based on the downstream usage.

  5. Add validation rules if needed

    For data-quality control, add a validation rule with LEN() to enforce minimum or maximum lengths beyond what the field itself enforces.

  6. Document in the data dictionary

    Record the chosen Length and the reasoning. Future admins inheriting the field will thank you.

Mandatory fields
Field Typerequired

Text, Long Text Area, Number, Currency, etc.

Lengthrequired

Maximum characters or digits.

Decimal Places (numeric)required

Precision for numeric fields.

External ID flag (text)required

Whether the field acts as an alternate key.

Unique flag (text)required

Whether the field enforces uniqueness.

Gotchas
  • Decreasing field length requires data validation. Production decreases can fail if any row exceeds the new shorter length.
  • Long Text Areas are not indexed by default. Searches against them are slow until indexing is enabled.
  • Standard field lengths cannot be changed. Integration code must respect them or DML fails with STRING_TOO_LONG.
  • Multibyte characters count as one each in LEN() but consume more bytes in storage. Database storage estimates need to account for the multibyte multiplier.
§

Trust & references

Sources

Cross-checked against the following references.

Official documentation

Straight from the source - Salesforce's reference material on Length.

Keep learning

Hands-on resources to go deeper on Length.

Was this entry helpful?
Help us write better definitions. Quick reactions or detailed edit suggestions.

About the Author

Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.

§

Test your knowledge

Q1. What does Length define on a Salesforce field?

Q2. Why does length matter?

Q3. Can you change length after field creation?

§

Discussion

Loading…

Loading discussion…