---
title: Using output filters
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Output filters modify the HTML code that the system renders for pages on the live site. The filters make changes to the code before sending it to the browsers of visitors. Output filters do not affect the pages of the Kentico administration interface.

> **Note:** **Note**: Applying output filters adds steps to the processing of pages, and may slow down the website. If the output code of your pages is already valid by default, and you do not need any of the filtering features, we recommend disabling the output filter for your website. See the [Applying output filters](#applying-output-filters-to-your-website) section for details.

## Output filter types

The following types of output filtering are available:

| Filter type                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Form filter**                   | The form filter fixes issue with non-working postbacks on pages that use URL rewriting. It ensures that forms, dialogs and buttons work correctly on pages managed by Kentico.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **URL resolving filter**          | Resolves relative URLs so that they contain the root URL of the website. For example, the filter changes _\~/mypage1/mypage2.aspx_ to:<br>_/mypage1/mypage2.aspx_ (if the application is running in the root)<br>or<br>_/VirtualDirectory/mypage1/mypage2.aspx_ (when using a virtual directory).<br>The filter only modifies URLs inside **src** and **href** attributes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| **XHTML filter**                  | Fixes XHTML incompatibilities. Specifically, the filtering functionality can ensure the following things:<br>**Valid tag attributes** - the attributes of HTML tags are generated in valid XHTML format.<br>**JavaScript tags** - the _type_ and _language_ attributes are included in all __ tags.<br>**Enforcing lower case** - all HTML tags and attributes are generated in lower case.<br>**Fixing self closing tags** - all HTML elements without closing tags are properly closed. For example __ is replaced by __.<br>**Indentation** - the HTML code of pages is organized into a properly indented, easier to read format.<br>You can also enable fixing of XHTML errors for content entered and saved in the system's WYSIWYG editors. This can be configured globally by adding the **CMSWYSIWYGFixXHTML** key into the _/configuration/appSettings_ section of your application's _web.config_ file:<br>`  <add key="CMSWYSIWYGFixXHTML" value="true" />
 `         |
| **HTML 5 filter**                 | The output filter provides a way to replace tag attributes that are obsolete in HTML5. Such attributes are removed and the system instead assigns CSS classes named in format _\__. You need to define these classes in the [CSS stylesheet](https://docs.kentico.com/k12sp/developing-websites/designing-websites-using-css.md) used by the website's pages.<br>The affected attributes are:<br>**cellpadding**<br>**cellspacing**<br>**width**<br>**height**<br>**border**<br>**align**<br>**valign**<br>For example:<br>`  <table cellpadding="2" cellspacing="4">
 `<br>is replaced by:<br>`  <table class="cellpadding_2 cellspacing_4"> 
 `                                                                                                                                                                                                                                                                                                                                 |
| **Converting Tables to Div tags** | You can use the output filter to automatically convert __ elements and their child __ and __ tags to __ elements with appropriate CSS classes assigned (named according to the replaced tag). You need to define these classes in the [CSS stylesheet](https://docs.kentico.com/k12sp/developing-websites/designing-websites-using-css.md) used by the website's pages.<br>For example:<br>`  <table>   <tr><td>A</td><td>B</td></tr> </table>
 `<br>is replaced by:<br>`  <div class="table">   <div class="tr">         <div class="td">A</div>         <div class="td">B</div>   </div> </div>
 `**Tip:** **Tip**: You can enable or disable table conversion for specific blocks of HTML code by marking them with _class="\_divs"_ or _class="\_nodivs"_ attributes. The filter then allows you to convert only tables designated by the _\_divs_ class, or all tables except for those marked with _\_nodivs_.<br>See the descriptions of the output filter settings below. |

## Applying output filters to your website

By default, the system applies the output filters to all pages. If you do not wish to use the filters for specific sections of the website (for example due to performance reasons), you can disable them through the **Settings** application in the **System -> Output filter** category.

- Individual _Excluded URLs_ fields are available for particular filter types.
- You can disable output filters for all pages that start with a specific URL path by entering this path into the corresponding field (without the \~ character and extension).
- Multiple URL paths may be added, separated by semicolons (;).

> **Note:** **Note**: The settings only exclude specific URLs, not entire pages. For example, if you exclude the _/Home_ URL path, but then access the Home page through a different URL or [alias](https://docs.kentico.com/k12sp/configuring-kentico/configuring-page-urls/setting-page-aliases.md) (such as the website root configured to display the Home page), output filtering will still be enabled.

Examples:

- **/** - disables the filter for the entire website.
- **/Products** - disables filtering for the Products page under the website root and all other pages whose URL path starts with _/Products_ (e.g. child pages).
- **/Services;/News** - excludes all pages whose URL path starts with _/Services_ or _/News_.
- **/Company.** - by adding the period character (".") after the URL path, you can exclude only one specific page, but not its child pages (this does not work with extensionless URLs).

The following table describes all website settings available in the **Output filter** category:

| General                               |                                                                                                                                                                                                                                                                       |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Excluded output form filter URLs      | Specifies the URLs of the pages that the system excludes from the Form output filter.                                                                                                                                                                                 |
| Excluded resolve filter URLs          | Specifies the URLs of the pages that the system excludes from the _URL resolving_ output filter.                                                                                                                                                                      |
| XHTML filter                          |                                                                                                                                                                                                                                                                       |
| Excluded XHTML filter URLs            | Specifies the URLs of the pages that the system excludes from all functionality provided by the XHTML output filter.                                                                                                                                                  |
| Excluded XHTML attributes filter URLs | Specifies the URLs of the pages that the system excludes from the _Tag attribute_ XHTML filter.                                                                                                                                                                       |
| Excluded XHTML JavaScript filter URLs | Specifies the URLs of the pages that the system excludes from the _JavaScript tag_ XHTML filter.                                                                                                                                                                      |
| Excluded XHTML lower case filter URLs | Specifies the URLs of the pages that the system excludes from the _Lower case_ XHTML filter.                                                                                                                                                                          |
| Excluded XHTML self close filter URLs | Specifies the URLs of the pages that the system excludes from the _Self closing tag_ XHTML filter.                                                                                                                                                                    |
| Excluded HTML5 filter URLs            | Specifies the URLs of the pages that the system excludes from the _HTML5_ output filter.                                                                                                                                                                              |
| Indent output HTML                    | Indicates if the system processes the HTML output of all pages into a properly indented, easier to read format. The indentation applies to all where the XHTML output filter is enabled.                                                                              |
| Convert TABLE tags to DIV tags        | Determines which tables the output filter converts to __ elements. Table conversion can be:<br>Disabled completely<br>Enabled for all tables except for those marked by the **\_nodivs** CSS class<br>Only enabled for tables designated through the **\_divs** class |

### Enabling output filters for specific web parts

You can enable the output filters separately for the code generated by [web parts](https://docs.kentico.com/k12sp/developing-websites/developing-websites-using-portal-engine/using-and-configuring-web-parts.md). This allows you to filter the output of specific instances of web parts, even if their page is excluded from the output filter via the website settings. This is also the recommended approach performance-wise over having output filters enabled for whole pages.

> **Note:** **Note**: The system always uses output filtering for web parts on pages that are not excluded through the website settings.

To access the output filter settings of web parts:

1. Open the **Pages** application.
2. Edit a page on the **Design** tab.
3. **Configure** (double-click) the web part.
4. Enable the **Filter output HTML of web part** property in the **Output filter** section.
   - This section of properties is available for all web parts.
5. Adjust the remaining properties in the Output filter section.

   - The configuration options correspond with the available types of output filters.

![Enabling output filtering for web parts](https://docs.kentico.com/docsassets/k12sp/using-output-filters/Output_Filter_WebParts.png "Enabling output filtering for web parts")
