Editing Rich Text Area Fields in Records
Use rich text area fields to improve the appearance of text, including adding images and hyperlinks.
Required Editions
| Available in: the Salesforce mobile app, Salesforce Classic, and Lightning Experience |
| Available in: Essentials, Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To create or change custom fields: | Customize Application |
Rich text area fields use the rich text editor to format content. The rich text editors for custom fields in Lightning Experience and the Salesforce mobile app have a few differences compared to rich text editors in Salesforce Classic.
In Lightning Experience and the Salesforce mobile app, rich text editors for custom fields use the open-source Quill library. In Salesforce Classic, rich text editors for custom fields use CKEditor. In Lightning Experience, Salesforce Knowledge and emails also use the CKEditor.
| Rich Text Editor Toolbar Button for Custom Fields | In Lightning Experience and the Salesforce mobile app | In Salesforce Classic |
|---|---|---|
| Color |
|
|
| Format Font (Bold, Italic, Underline, Strikethrough) |
|
|
| Format Body (Bulleted List, Numbered List, Indent, and Outdent) |
|
|
| Align Text (Left Align, Center Align, and Right Align) |
|
|
| Insert Link |
|
|
| Insert Image |
|
|
| Remove Formatting |
|
|
| Undo and Redo Last Action |
|
Note these differences across rich text editors in Lightning Experience and the Salesforce mobile app compared to Salesforce Classic.
In Lightning Experience and the Salesforce mobile app:
- Spaces are considered non-empty values.
- The default font family is the native sans-serif font on your system or device.
- The Insert Link button enables you to enter a URL with the
_blanktarget value by default. This button appears disabled when the record edit page is loaded, and is enabled after you activate the editor with your keyboard or mouse. - The Insert Image button enables you to insert an image. You can upload an image using the system file picker only. The image upload can vary across rich text editors in different feature areas. For example, in the Chatter publisher on a record page, you can also select an image that has been previously uploaded to your org.
- The Left Align button inserts a
<p>element around the content. - Use keyboard shortcuts to undo and redo content formatting. In Windows, undo your last action by pressing Ctrl+Z, and reverse your last undo by pressing Ctrl+Y. On Mac OS, use Cmd+Z and Cmd+Y. Alternatively, use the Edit menu in your browser to undo or redo your changes.
In Salesforce Classic:
- Spaces are considered empty values.
- The default font family is Arial, Verdana, Trebuchet MS, sans-serif.
- Color formatting is preserved when you switch to Salesforce Classic to edit a custom field that’s been formatted in Lightning Experience or the Salesforce mobile app. This occurs even though the Color button isn’t available in Salesforce Classic.
- The Insert Link button lets you enter a URL with a selection of protocols and target values. When you switch to Lightning Experience or the Salesforce mobile app and edit the custom field, unsupported protocols or target values aren’t preserved.
- The Insert Image button lets you insert an image by uploading it or reference one that’s hosted on another server.
- The Left Align button initially inserts a
<p>element around the content. If you remove the left alignment formatting and reuse the Left Align button on existing text that was previously left-aligned, extra<div>tags are added.
Implementation Tips
- Specify the size of the editor box for a rich text field by configuring the Number of lines displayed property in the field’s setup.
- When you view or print content, Salesforce preserves the formatted version of the rich text.
- Searches of content that contains rich text area fields ignore images and tags.
- Deleting a rich text area field moves it to the Deleted Fields section on the custom object or Salesforce Knowledge article types.
- You can convert rich text area fields into long text area fields only. Any images get deleted the next time you save the long text area field. After converting, markup is hidden in the long text area field but it isn’t removed from the record, so if you change your mind, you can restore the markup before you save the record.
- The text part of a rich text area field counts toward data storage for the object that contains the field.
Pasting Content from External Sources
- You can copy and paste text from external sources, such as Microsoft® Word, but sometimes doing so requires reapplying the formatting.
- Text from external sources can include HTML tags and special formatting that you can’t see and don’t need. The tags are counted against the character limit of a field. We recommend pasting text into a plain text editor such as Notepad on Windows or TextEdit on macOS first. Copy the text from the plain text editor, paste it into a rich text field, and apply formatting using the rich text field’s buttons.
- JavaScript and CSS are treated as text. For example, if you’re creating an Idea through the API, the JavaScript or CSS code is removed without warning. Salesforce supports a limited number of approved HTML tags.
- When a rich text area field is used in a formula, the HTML tags are stripped out before the formula is run.
- Rich text area fields can be filtered and summarized in reports, but HTML tags and
special formatting aren’t included in report results. For example,
<b>some</b> <i>text</i>becomes “some text” instead of <b>some</b> <i>text</i> or some text. - You can use a rich text area field in a mail merge, but the HTML tags are included as text in the resulting document. Images aren’t merged.
Images in Rich Text Area Fields
- The maximum size of an image that can be uploaded in a rich text area field is 1 MB. You can upload only .gif, .jpg, and .png file types.
- To upload many images, use API version 20 or later.
Note When you upload images via the API, thealtattribute isn’t populated unless you specified it separately. - Images uploaded into a rich text area field are extracted in your org’s weekly export and included in the exported data.
- Images in rich text area fields count toward file storage for the object that contains the field.
- You can’t add a hyperlink to an image.
- You can’t upload an image to a rich text area using the file:// protocol in the URL field. Instead, use http:, https:, data:, //, /, or a relative URL.
- You can’t resize images in Lightning Experience and the Salesforce mobile app. An exception to this is in Lightning Knowledge when using the Chrome browser.
Formatting Support
The power of the rich text editor is in its WYSIWYG interface. Type in the editor and use the toolbar to format your content as much as you can. When you paste formatted content from another source, you can expect some formatting differences in Lightning Experience and the Salesforce mobile app. Here are formatting considerations to look out for.
- Colors
- The Color button is available in Lightning Experience only.
Color formatting is preserved when you edit the rich text field in Salesforce Classic.
The rich text field in Lightning Experience handles color formatting in RGB format,
which adds the
<span style="color: rgb(255, 0, 0);"></span>tag around your text. The rich text field in Salesforce Classic handles color formatting in hexadecimal format, which adds the<span style="color: #ff0000;"></span>tag around your text. The RGB and hexadecimal value depends on the color you choose. - Definition lists
-
Formatting for definition lists is preserved, but the styling appears different in Lightning Experience and the Salesforce mobile app. Definition terms are not bold.
- Fonts
-
Pasting text with a predefined font face, color, or size converts the
fonttag into aspantag with thestyleattribute. - Headings
- Heading styles are different in Lightning Experience and Salesforce Classic. Headings
in Salesforce Classic are bold and become smaller in size as the header level increases
in number. Headings in Lightning Experience have the following font size and weight.
h1: 24 px (not bold)h2: 18 px (bold)h3: 18 px (not bold)h4: 14 px (bold)h5: 14 px (not bold)h6: 12 px (bold)
- Inline styles on
h1,h2,h3,h4,h5, andh6tags are not supported and are ignored. - Hyperlinks
- Hyperlinks always open in a new window or tab in Lightning Experience and the
Salesforce mobile app using
target=”_blank”. In Salesforce Classic, you can use differenttargetvalues in hyperlinks in the rich text field. If you edit a rich text field with such a link in Lightning Experience or the app, thetargetvalue is converted to_blank. - Inline styles
- In Salesforce Classic, inline styles are supported on
div,span,p,br, andhrtags. In Lightning Experience and the Salesforce mobile app, inline styles are supported only onspantags. - Lists
- Nested ordered lists in rich text fields are numbered differently in Salesforce Classic than they are in Lightning Experience and the Salesforce mobile app. In Salesforce Classic, nested ordered lists are numbered with this pattern: 1, 1, 1. In Lightning Experience and the Salesforce mobile app, nested ordered lists are numbered with this pattern: 1, a, i.
- In Lightning Experience and the Salesforce mobile app, you can’t nest a bulleted list within a numbered list. The nested bulleted list is converted to a numbered list when you paste it into the editor.
- You also can’t nest a numbered list within a bulleted list. The nested numbered list
is converted to a bulleted list when you paste it into the editor.
Warning Nesting lists of different types is supported in Salesforce Classic only. Don’t edit an existing rich text area field containing a nested list of a different type in Lightning Experience and the Salesforce mobile app. If you do, the nested list is converted to the same type as its parent list, even if you don’t edit the list itself. -
Nested lists of the same type are supported. However, pasting a nested list into the editor flattens the list into one list in Lightning Experience and the Salesforce mobile app. For example, a nested bulleted list within a bulleted list becomes a single bulleted list when pasted. For nested lists of the same type, use the toolbar to adjust your list formatting. You can also press the Tab key or Shift+Tab to create a nested list item or remove a nested list item.
Note In Lightning Experience and the Salesforce mobile app, pasting lists that are copied from Microsoft® Word is not supported and results in list items getting converted into paragraphs. Although they look visually like lists, they are pasted asptags. - Paragraphs and line breaks
- Pressing the Enter key creates a paragraph in Lightning Experience and the Salesforce
mobile app. However, pressing the Enter key in Salesforce Classic adds a
<br>element inside the current paragraph. The visual difference is minor. - Markup for blank lines is
<p><br></p>in Lightning Experience and the Salesforce mobile app, and<br>in Salesforce Classic. If you create text in a rich text field in Lightning Experience or the Salesforce mobile app and later edit it in Salesforce Classic, markup for the blank lines is converted to<p> </p>. Subsequent edits in Lightning Experience or the Salesforce mobile app don’t change blank lines back to their original markup. - Paragraphs in rich text editors add extra characters to the text when saved in
Lightning Experience and the Salesforce mobile app. Each paragraph contributes seven
characters
<p> </p>to the character count. For example, if your admin specifies a 5000 character limit, you can enter only 4993 characters in the rich text editor of a custom field in Lightning Experience. Breaking the text into multiple paragraphs further reduces the number of characters you can enter. Blank lines contribute no visible characters, but contribute several characters with their markup. -
Note RichText field values are returned in HTML format. That means it might contain block elements. Nesting block elements as merge fields in inline elements can cause formatting issues in HTML. If you're using the RichText custom field as a merge field, consider applying HTML customizations, like fonts, to the custom field itself. If you want only text data in the custom field, use TextField instead. - Special Characters
- Since rich text field values are returned in HTML format, some characters are escaped
when the custom field value is retrieved through the API.
- Ampersand character
&is returned as& - Greater than character
>is returned as> - Less than character
<is returned as< - Quote character
"is returned as" - Single quote character
'is returned as' - Some special characters, such as emoji, are rendered in inconsistent formats. The return value depends on your platform and the receiving end of the API response.
- Ampersand character
- Tables
- In Salesforce Classic, Lightning Experience, and the Salesforce mobile app, pasting tables is supported, but you can edit only the content within the tables.
- Text-level markup
-
- Addresses with
addresstags cause enclosing list formatting to be removed. - Nested quotes using
qtags are not supported. - Strikethrough text uses
striketags. - Teletype text within
tttags is converted to usecodetags.
- Addresses with
This table lists supported HTML tags and formatting considerations in Lightning Experience and the Salesforce mobile app. When you edit a rich text field or paste text with unsupported tags in Lightning Experience and the Salesforce mobile app, those tags are removed. Text that was enclosed in unsupported tags is preserved as plain text.


