HTML Digital Clock for website


  • HTML and Javascript code to create a digital clock on your website that will always display the current time on a page. Each digit for the clock is image based.


  1. Save the number images and stick them in the same directory as the page. (you can also download a zip file of everything)
  2. Copy and Paste the Source Code into your HTML page.
  3. You are welcome to use your own images for this. Just be sure the image names are the same as the ones used here. (eg; "dg8.gif" for the "8")
  4. For those of you looking for more, there is also 24 Hour Version and a Time Zone offset version (change the tzOffset variable), and a date version (date version can be combined with a time version).

Source Code

Numbers to save: (or zip of files)


I want to place clocks at varying places with different tzoffsets. When I do the entire code, the first one reads the time when webpage first loads but does not run, the subsequent clocks just show all 8s.

Unfortunately you won't be able to place multiple copies of this digital clock on the same page. The naming conflicts so the script doesn't know what images to change.