HTML code in Confluence HTML macro is not working

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

HTML macros are disabled by default

The HTML macro will only be available if it has been enabled by an administrator. Enabling these macros can make your Confluence site vulnerable to cross-site scripting attacks.

HTML code in the Confluence HTML macro is not working when the code contains some HTML tags.

Environment

Confluence HTML macro

Diagnosis

Check if the HTML code inside the macro has the below HTML tags:

  1. <html></html>

  2. <head></head>

  3. <body></body>

Cause

Confluence HTML macro already has those HTML tags predefined.

Solution

Remove the above HTML tags then save the page.

Updated on March 21, 2025

Still need help?

The Atlassian Community is here for you.