How to Add a Countdown Timer to Squarespace
November 8, 2026 · 3 min read
A countdown makes a deadline feel real: a launch, an early-bird price, Christmas Eve services, the last day to register. Squarespace has no countdown block, but a few lines of code add one to any page.
Before you start
The code below uses JavaScript, so it needs a Code Block, which runs on Squarespace's Core, Plus and Advanced plans (and legacy Business and Commerce). On the Basic plan, see how to add custom code without upgrading.
Free code: a countdown to any date
Edit the page, click Add Block, choose Code, and paste:
<div class="my-countdown" data-end="2026-12-24T18:00:00-06:00" data-done="We're live!">
<span data-unit="d">0</span><small>days</small>
<span data-unit="h">0</span><small>hours</small>
<span data-unit="m">0</span><small>minutes</small>
<span data-unit="s">0</span><small>seconds</small>
</div>
<style>
.my-countdown { display: flex; justify-content: center; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; text-align: center; }
.my-countdown span { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 1.6em; }
.my-countdown small { margin-right: 14px; opacity: .7; }
</style>
<script>
document.querySelectorAll(".my-countdown").forEach(function (el) {
var end = new Date(el.dataset.end).getTime();
function tick() {
var s = Math.max(0, Math.floor((end - Date.now()) / 1000));
var parts = { d: Math.floor(s / 86400), h: Math.floor(s % 86400 / 3600), m: Math.floor(s % 3600 / 60), s: s % 60 };
for (var k in parts) el.querySelector('[data-unit="' + k + '"]').textContent = parts[k];
if (s === 0) { el.textContent = el.dataset.done; return; }
setTimeout(tick, 1000);
}
tick();
});
</script>
Change two things:
- **
data-end**: the date and time to count down to, in the formYEAR-MONTH-DAYTHOUR:MINUTE:SECOND, followed by your time zone's offset from UTC (more on that below). - **
data-done**: the message that replaces the timer when it reaches zero.
The countdown uses your site's font and text color. Change 2.6rem to make the numbers bigger or smaller.
The time zone gotcha
If you leave the offset off the end of the date (2026-12-24T18:00:00), each visitor's browser counts down to 6 PM in *their own* time zone. Someone in California would see a different deadline from someone in New York.
For a real deadline, add your offset so everyone counts down to the same moment:
| Your time zone | Offset in winter | Offset in summer |
|---|---|---|
| Eastern | -05:00 | -04:00 |
| Central | -06:00 | -05:00 |
| Mountain | -07:00 | -06:00 |
| Pacific | -08:00 | -07:00 |
| UK | Z | +01:00 |
Use the offset that applies on the deadline date, not today. A December deadline in Chicago is -06:00 even if you set it up in July.
A countdown on every page
A countdown in a Code Block shows on one page. For a sale or event, it often works better as a bar across the top of every page with a button, like "Early-bird pricing ends in 2d 4h 12m · Register".
Squarespace's built-in Announcement Bar (under Pages → Website Tools → Announcement Bar) shows one message on every page. It has no countdown, no button and no end date, so you have to remember to turn it off afterward.
How to add an announcement bar with a countdown to Squarespace covers the options, including code for a site-wide bar.
The ready-made option
The Announcement Bar puts a countdown bar on every page:
- A live countdown with a button, in your colors
- Start and end dates, so the bar appears and disappears on schedule
- Rotating messages, a dismiss button that remembers, and an optional Google Sheet so your team can change the message
- Works on every Squarespace plan, plus a WordPress plugin
It's $19 once, for unlimited sites. The free Announcement Bar Builder lets you design yours and see it live first.