---
schema_version: "1"
id: 8020835127cd3abc28b75c715f8adb0c38f81f94189f646e00e030a5ab5379ea
title: HTMLENCODE
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/customize_functions_htmlencode.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.customize_functions_htmlencode.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: bbecb488f83d5e7b8b878ac3ecc69d75f8b3f1f020d49df60d672b9c5134e629
description: Encodes text and merge field values for use in HTML by replacing characters that are reserved in HTML, such as the greater-than sign (>), with HTML entity equivalents, such as &gt;.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# HTMLENCODE

Encodes text and merge field values for use in HTML by replacing characters that are reserved in HTML, such as the greater-than sign (>), with HTML entity equivalents, such as `&gt;`.

## Use

`{!HTMLENCODE(text)}` and replace text with the merge field or text string that contains the reserved characters.

## Tips

This function is only available in custom buttons and links, and in Visualforce.

![Example](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)

Example If the merge field `foo__c` contains `<B>Enter the user's name<b>`, `{!HTMLENCODE(foo__c)}` results in: `&lt;B&gt;Enter the user&#39;s name&lt;/b&gt;`