---
schema_version: "1"
id: cfafdf1c60513724df73826eef1a06dadd32888c6ed45045838c3fac67989730
title: apex:outputText
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/components/pages-compref-outputtext.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-compref-outputtext.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b1827137b6ca5da1cf2e7ef913edf2b790baaef83b4e241c2fce0b43f8808e70
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# apex:outputText

Displays text on a Visualforce page. You can customize the appearance of `<apex:outputText>` using CSS styles, in which case the generated text is wrapped in an HTML `<span>` tag. You can also escape the rendered text if it contains sensitive HTML and XML characters.

Use this component to get user input for a controller method that does not correspond to a field on an sObject. Only `<apex:inputField>` and `<apex:outputField>` can be used with sObject fields.

Use with nested param tags to format the text values, where {n} corresponds to the n-th nested param tag. The `value` attribute supports the same syntax as the MessageFormat class in Java.

**note:** In API version 31.0 and earlier, encrypted custom field values that are embedded in the `<apex:outputText>` component display in clear text. The `<apex:outputText>` component doesn't respect the View Encrypted Data permission for users. To prevent showing sensitive information to unauthorized users, use the `<apex:outputField>` tag instead.

In API version 32.0 and later, encrypted custom field values are masked.

This component supports [HTML pass-through attributes](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_html_features_pass_through_attributes.htm) using the "html-" prefix. Pass-through attributes are attached to the generated container `<span>` tag.

## Basic formatting example

```apex
<apex:page>
    <apex:outputText style="font-style:italic" value="This is {0} text with {1}.">
       <apex:param value="my"/>
       <apex:param value="arguments"/>
    </apex:outputText>
</apex:page>
```

The example above renders the following HTML:

```html
<span id="theText" style="font-style:italic">This is my text with arguments.</span>
```

## Date formatting example

```apex
<apex:page>
   <apex:outputText value="The unformatted time right now is: {! NOW() }" />
   <br/>
   <apex:outputText value="The formatted time right now is:
         {0,date,yyyy.MM.dd G 'at' HH:mm:ss z}">
       <apex:param value="{! NOW() }" />
   </apex:outputText>
</apex:page>
```

The example above renders the following HTML:

```html
The unformatted time right now is: 11/20/2004 3:49 PM
<br />
The formatted time right now is: 2004.11.20 AD at 23:49:02 GMT  
```

## Currency formatting example

```apex
<!-- For this example to render properly, you must associate the Visualforce page
with a valid account record in the URL.
For example, if 001D000000IeChM is the account ID, the resulting URL should be:
https://MyDomain_login_URL/apex/myPage?id=001D000000IeChM
See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->

<apex:page standardController="Account">
It is worth:
<apex:outputText value="{0, number, 000,000.00}">
       <apex:param value="{!Account.AnnualRevenue}" />
 </apex:outputText>
</apex:page>
```

The example above renders the following HTML:

```html
It is worth: 500,000,000.00
```

## Attributes

|Attribute Name|Attribute Type|Description|Required?|API Version|Access|
|--------------|--------------|-----------|---------|-----------|------|
|`dir`|String|The direction in which the generated HTML component is read. Possible values include "RTL" (right to left) or "LTR" (left to right).| |10.0|global|
|`escape`|Boolean|A Boolean value that specifies whether sensitive HTML and XML characters should be escaped in the HTML output generated by this component. If you don’t specify escape="false", the character escape sequence displays as written. Be aware that setting this value to "false" may be a security risk because it allows arbitrary content, including JavaScript, that could be used in a malicious manner.| |10.0|global|
|`id`|String|An identifier that allows the outputText component to be referenced by other components in the page.| |10.0|global|
|`label`|String|A text value that allows to display a label next to the output text| |23.0||
|`lang`|String|The base language for the generated HTML output, for example, "en" or "en-US". For more information on this attribute, see [the W3C specifications](http://www.w3.org/TR/REC-html40/struct/dirlang.html).| |10.0|global|
|`rendered`|Boolean|A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.| |10.0|global|
|`style`|String|The style used to display the outputText component, used primarily for adding inline CSS styles.| |10.0|global|
|`styleClass`|String|The style class used to display the outputText component, used primarily to designate which CSS styles are applied when using an external CSS stylesheet.| |10.0|global|
|`title`|String|The text to display as a tooltip when the user's mouse pointer hovers over this component.| |10.0|global|
|`value`|Object|The text displayed when this component is rendered. This value supports the same syntax as the MessageFormat class in Java.| |10.0|global|

