SS
Squarespace Sites
← All Answers
Getting Started

How do I add custom code to my Squarespace site?

Guide to adding custom CSS, JavaScript, and HTML to Squarespace through code injection, code blocks, and custom CSS — requires Business plan or higher.

Squarespace supports custom code through three main methods, all requiring the Business plan or higher. Code Injection (Settings > Advanced > Code Injection) lets you add code to the header or footer of every page on your site — perfect for analytics scripts, meta tags, and site-wide CSS or JavaScript. Per-page code injection adds code to specific pages only, which is useful for page-specific tracking or functionality.

For inline custom code within your page content, use Code blocks. Edit your page, click an insert point, and add a Code block. This lets you add HTML, CSS, or JavaScript directly within your page layout. Code blocks are useful for embedding third-party widgets, adding custom forms, or creating one-off design elements that the standard Squarespace blocks do not support.

For CSS customization, Squarespace also has a dedicated Custom CSS editor under Design > Custom CSS. This is the best place for design modifications like changing fonts, adjusting spacing, hiding elements, and overriding template default styles. Custom CSS applied here affects your entire site and persists across template changes. When writing custom CSS for Squarespace, use your browser's developer tools to inspect element class names and test your CSS before pasting it into the editor.

Related Questions

Ready to build your website?

Browse our collection of premium Squarespace templates designed specifically for service businesses.

Browse Templates