This article was originally written for my blog here -> https://easyontheweb.com/difference-between-static-and-dynamic-websites/
You might not believe it but the most frequently asked question to me about my work is “What is the difference between static websites and dynamic websites ?” . Here, I’m not talking about this questions being asked in interviews and all but this question being asked to me by people who have little knowledge of how the internet works. Not zero knowledge as well, they wouldn’t know that two such things exist.
So, for all the enthusiasts out there let me once and for all give an answer from my side about what is the difference between static and dynamic websites. We’ll also be talking about a lot of other things such as APIs, sites which seem dynamic but are actually not and many other things in this article but still if I could sum this up in one paragraph answer the next paragraph would be it.
Static websites are the ones which display the same content to all the users and the content is not based on any user specifications whereas dynamic websites are the ones which show different content to different users based on user specifics (usually the user profile).
Now, this is the most brief explanation I can give to you about it. We will discuss this in depth in rest of the article.
Most of the websites that we see on the internet are what we call static websites. Static websites are the ones which show the same information to anyone who opens the website. It doesn’t matter where you open this website from, no matter you have previously opened this site or not.
In more technical terms, these are the websites that are written in just HTML and CSS (and also JS for dynamic effects). They contain a fixed number of webpages, follow a fixed pattern of information display and seldom change.
The content on these websites need not be just text though, the content can be anything from images to videos to anything else actually. But what the main thing is that this content will not be based on the user. This content will be the same for all the users.
If you are a web developer you might understand this – the source code of static websites is always the same. The same response is sent to the browser no matter who the user is or what is he asking for.
A cool static website that you can check out is this -> https://poke95.now.sh/
These are the type of websites that you and me mostly use these days. They were not very prevalent in the earlier days of the internet but these days everyone is mostly coming out with dynamic websites. Now, dynamic websites are the ones on which the content changes with respect to the user using the website.
Let us take the easiest example possible of Youtube. Now, you know that youtube recommends videos to you based on your previous videos watched. It stores your browsing history and previous videos watched history and then dynamically creates content specifically that you would be interested in and shows that on the page.
A very closely related thing to dynamic websites is what are called Web applications. Web applications are nothing but dynamic websites with certain extra features like maybe login, profiles etc. There are numerous web applications we use on a day to day basis like Facebook or Twitter or Youtube for that matter.
Dynamic websites give you a much better user experience and cater to your personal needs most of the times but expectedly they are much harder to develop and maintain for the developers as compared to static websites.
Main differences between static and dynamic websites
Static websites send the same response every time to the browser whereas dynamic websites send different response. Hence, static websites tend to be faster.
Static websites do not use databases whereas dynamic websites do use databases.
Static websites use technologies like HTML,CSS whereas dynamic websites could use PHP,Ruby,Python etc.
Static websites take less time and effort to develop than dynamic websites.
Which one should you choose ?
As most of the technical answers in the world – it depends. It depends on your use case the most. If you just want to display some kind of information to your audience and this information won’t be changing according to them or time then you should go for static websites.
But if you want to include features and personalisation into your website then obviously you’ll have to go for dynamic websites or web applications. You should think long and hard about what do you want from your website and only then make a decision on how to implement it or get it implemented.