Developer and Text Tools

How to Add a Countdown Timer to Your Website or Online Shop

Fixed or evergreen countdowns, time zones done right, what to show at zero, and how to paste one snippet into WordPress, Shopify, Wix or plain HTML.

Saizul Amin
Saizul Amin5 Nov 2026 · 4 min read
How to Add a Countdown Timer to Your Website or Online Shop

A countdown turns a date into something people can feel. Two days, three hours and thirty minutes left in a sale is more persuasive than ends on Friday, and a launch countdown gives visitors a reason to come back. Many countdown services, however, load scripts from their own servers, track your visitors and add their logo. A countdown can be a few lines of HTML, CSS and JavaScript that live entirely on your page.

Fixed or evergreen

A fixed countdown ends at one moment for everyone: the end of a sale, the start of a live stream, the closing of early-bird tickets. Every visitor, anywhere in the world, sees the same amount of time left.

An evergreen countdown starts when each visitor first arrives and runs for a set number of hours, remembered in their browser. It suits genuinely personal offers, such as a welcome discount valid for 48 hours after someone signs up. It must be honest: showing a deadline that quietly resets on every visit misleads customers and breaks consumer rules in many countries. If you advertise an offer, honour it.

Time zones, done once

The most common countdown bug is the time zone. A sale that ends at midnight is a different moment in New York, London and Dhaka. The right approach is to state the end time in the zone your business works in and convert it to one exact moment. The visitor's browser then simply subtracts the current time. Daylight saving changes are handled by the time-zone database built into every modern browser.

What to show

Days, hours, minutes and seconds are the usual units. For deadlines weeks away, hide the seconds; the constantly changing number adds stress without information. If you hide days, the hours keep counting past 24, so 49 hours is shown instead of 2 days and 1 hour. Labels can be full words, short letters or none.

Leading zeros, such as 05 instead of 5, keep the width steady so the layout does not jump every second. Tabular numbers in the CSS help with the same thing.

At zero

Decide what happens when the timer ends. Showing a short message, such as The sale has ended, is the friendliest choice. Hiding the widget keeps the page clean. Redirecting to another page suits webinars, where zero means the room is open. Never leave a frozen row of zeros on the page.

Building one with the generator

The Countdown Timer Widget Generator writes the whole widget as one snippet.

  1. Choose the type. Fixed or evergreen.
  2. Set the moment. Enter the date, time and the time zone of that time, or the evergreen length in hours. The panel shows the end in your own time zone and the time left right now.
  3. Pick a look. Start from a theme, then change the layout (boxes, plain numbers, circles or a progress bar), colours, number size, radius, font and alignment.
  4. Decide the ending. Choose a message, hiding or a redirect, and add an optional button such as Shop now.
  5. Check it. The live preview runs the real snippet. The checks warn if the end time has already passed, if the text contrast is low, or if a redirect address does not use https.
  6. Copy the snippet. One block of HTML with its own style and script.

Installing it

  • WordPress: add a Custom HTML block and paste the snippet.
  • Shopify: in the theme editor, add a Custom Liquid section and paste it.
  • Wix and Squarespace: use the embed or code block.
  • Plain HTML: paste it where the timer should appear.

Some visual page builders strip scripts in their main editor; use their code or embed element instead. For two timers on one page, give each its own id in both the HTML and the script.

Accessibility and performance

The widget uses role="timer" and does not announce every tick to screen readers, which would make the page unusable for them. The button has a visible focus ring. The script is a few kilobytes, makes no network requests and updates once a second, so it does not slow the page down.

A note on clocks

The countdown relies on the visitor's device clock. If someone's clock is set wrong, their countdown is wrong too, although the end moment you chose stays correct. For deadlines that matter legally, such as entry closing times, state the end date and time zone in words next to the timer, and enforce the deadline on your server rather than in the browser.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages