Add custom code to your site

false

Add custom code to your site

Last updated August 27, 2026 16:04

Enhance your site's design with custom code options like code injection, code blocks, and custom CSS.

Use custom code to further customize your site. We highly recommend that you have coding knowledge before adding custom code.

Tip: Adding code to your site is an advanced modification that falls outside the scope of Squarespace support. If you have coding knowledge and need more help, visit the Squarespace Forum. You can also join Squarespace Circle, a community of creative professionals who may be able to answer more technical questions. If you don't have coding knowledge but want to add custom code to your site, consider hiring a Squarespace Expert.

Watch a video

Code blocks

Add code blocks to specific pages to change its layout or design, embed third-party widgets, or customize pages beyond what's possible with other blocks. You can also use code blocks to render HTML and Markdown or display code snippets.

Code blocks are versatile and can render code in HTML and Markdown. You can also use them to display code snippets. It’s common to use code blocks for code-based customizations like:

On all plans, code blocks support plain text, HTML, Markdown, and CSS code surrounded by <style></style> tags.

Adding JavaScript or iframes to code blocks is available in the Core, Plus, Advanced, and some legacy billing plans. Learn more about choosing the right Squarespace plan.

Code injection

Use code injection to add HTML and scripts that enhance specific parts of your site. These might include live chat services, domain verification for custom email services, or site analytics.

Code injection is available in the Core, Plus, Advanced, and some legacy billing plans. Learn more about choosing the right Squarespace plan.

CSS editor

Use the CSS editor to customize your site beyond the built-in styling options. CSS should only be used to change fonts, colors, and backgrounds. Other CSS changes could potentially harm your site.

The CSS editor is available on all plans.

Embed blocks

Use embed blocks to add external content to your site, such as videos, tweets, Facebook posts, and more.

The embed block pulls content from external sites and services that use the oEmbed Standard. If you have more advanced or customizable code, use a code block.

Embed blocks are available on all plans.

Is server-side code supported?

No. Squarespace doesn’t support server-side code, including PHP, Ruby, Ruby on Rails, and SQL.

The Squarespace Developer Platform (version 7.0 only)

The Squarespace Developer Platform is an advanced tool that developers can use to customize their site beyond our built-in custom code tools. The Developer Platform is designed for people with advanced coding knowledge. If you’re already using the Developer Platform, visit our Developer Docs.

The Developer Platform is only available in version 7.0 on the Core, Plus, Advanced plans.

I can't paste my custom code

If you're having issues pasting in your code, try the keyboard shortcut. Click in the area you want to paste, and then press:

PC Mac
Ctrl + V Command + V

My custom code doesn’t appear

If your custom code doesn't appear, refresh your browser. If that doesn't help, it may be because:

  • You’re logged in - As a security measure, code in a code block may not appear for you when you’re logged in, even if visitors can see it. This happens when you try to view embedded JavaScript over a secure connection (https://). To test this, visit your site in an incognito browser.
  • The code is on an index page - Your code might not render if you've added it to a page within an index. To test this, remove the page from the index within the Pages panel, then visit your site in an incognito browser.
  • You enabled Ajax loading - Occasionally, Ajax may conflict with embedded custom code, code-based customizations, anchor links, and URL redirects. To resolve the issue, try disabling Ajax loading.

If the code still isn't working, reach out to the source of the code, as they're most familiar with the code and the way it’s supposed to work. Third party code falls outside the scope of Squarespace support, so we can’t help you with any additional troubleshooting.

I’m getting a CORS error

You’ll receive a CORS (Cross Origin Resource Sharing) error if you use JavaScript to make requests from a browser. All requests must originate from a server side application. We don’t support CORS requests.

Coding resources

Here are a few popular and credible websites we recommend for tutorials, troubleshooting, and reference guides:

Was this article helpful?

Yes No

1040 out of 2228 found this helpful

Yes No

Add custom code to your site