Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Animated SVG clock

Click the clock to show a SVG file where JavaScript is executed to show your current time

Technical details

  • CSS-based animation
  • Use JavaScript to set the current time
  • W3C Validation

GitHub usage

JavaScript code of an SVG in <img> will not be executed, the SMIL or CSS-based animation is fine, therefore, what you see on GitHub page is an animated clock starting from 00:00, it basically counts the time you have stayed on the page.

Even if you open the (not raw SVG file (here it is) directly in your browser, the JavaScript code will still not be executed due to "Content Security Policy: sandbox" header.

In order to execute the JavaScript code and correctly show the current time, you can:

  • open a SVG image (here is one) directly in your browser
  • or download the SVG file, then open it directly in your browser
  • or embed it directly (not via <img>) in your website, in or any website that does not have strict Content Security Policy header and does not sanitize custom JavaScript code in SVG

Use it (Markdown, can't set width and height):

![Clock]( "Clock")

Use it (HTML, with width and height set):

<img src="" alt="Clock" title="Clock" height="200px" width="200px">


Yes it's highly similar to a Swiss railway clock whose design IS COPYRIGHTED.


By Tom Chen

Inspired by SVG animation: by HackaLittleBit (, CC-by-sa 4.0, whose original SVG is: by Jahoe (, CC-by-sa 3.0 & GFDL

(The current SVG code has significate code change comparing to HackaLittleBit's work, and is using the permissive MIT license)


MIT license for the code, but Swiss railway clock DESIGN IS COPYRIGHTED.


No releases published


No packages published