How to remove custom CSS from Confluence via the database

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

If custom CSS has been added to Confluence and has broken page rendering, there is a chance it will need to be removed from the database instead of through the Confluence UI.

Solution

Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

Steps to remove custom CSS from a particular space

  1. Stop Confluence

  2. Confirm the space has CSS you need to remove via the following query (replace <spacekey> with the spacekey from the affected space):

    1 select * from BANDANA where BANDANAKEY like '%atlassian.confluence.css.resource.custom%' and BANDANACONTEXT='<spacekey>';
  3. Run the following query to delete any custom CSS associated with that space

    1 delete from BANDANA where BANDANAKEY like '%atlassian.confluence.css.resource.custom%' and BANDANACONTEXT='<spacekey>';
  4. Start Confluence

Steps to remove custom CSS from all spaces

  1. Stop Confluence

  2. Confirm that custom CSS stylesheets exist in any space with the following query:

    1 select * from BANDANA where BANDANAKEY like '%atlassian.confluence.css.resource.custom%' and BANDANACONTEXT!='_GLOBAL';
  3. Run the following query to delete all custom CSS stylesheets for any space:

    1 delete from BANDANA where BANDANAKEY like '%atlassian.confluence.css.resource.custom%' and BANDANACONTEXT!='_GLOBAL';
  4. Start Confluence

Steps to remove CSS from the Global Stylesheet

  1. Stop Confluence

  2. Confirm there is a custom Global Stylesheet via the following query:

    1 select * from BANDANA where BANDANAKEY like '%atlassian.confluence.css.resource.custom%' and BANDANACONTEXT='_GLOBAL';
  3. Run the following query to delete any custom Global Stylesheets:

    1 delete from BANDANA where BANDANAKEY like '%atlassian.confluence.css.resource.custom%' and BANDANACONTEXT='_GLOBAL';
  4. Start Confluence

Steps to remove all custom CSS Stylesheets

  1. Stop Confluence

  2. Run the following to delete any custom stylesheets:

    1 delete from BANDANA where BANDANAKEY like '%atlassian.confluence.css.resource.custom%';
  3. Start Confluence

NOTE

When you modify a Custom CSS for a Space from UI and remove it completely (delete it) , its entry will be stored with <null> value in Database. The reason this value is still kept in DB is because when you modify a Custom CSS from UI and then remove it completely, you are technically editing it and not deleting it. Also, the button on UI says Edit and not Delete.

(Auto-migrated image: description temporarily unavailable)

So if you want to pull the list of all Spaces which currently have Custom CSS and was deleted in past, you can run the below query to fetch those Spaces.

1 select * from BANDANA where BANDANAKEY like '%atlassian.confluence.css.resource.custom%' and BANDANACONTEXT='<spacekey>' AND BANDANAVALUE !='<null/>'
Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.