DEV Community


Static VS Dynamic Websites

mindful_developer profile image Biagio J Mendolia ・2 min read

At a high level, there are generally two different types of websites, a static website and a dynamic website.

Basically, a dynamic website displays the same layout but different content for each user (like Facebook, Twitter, etc.). So if you and your friend are on Twitter at the same time you both see the same exact layout but the content inside that layout is different. This is because the pages are dynamically generated. Long story short, when you go to it asks you for your username and password which then tells the Twitter server who you are so it knows what information to generate on the dynamic web page. Dynamic websites give you the ability to put logic in your code making it convenient and easy to maintain. However, dynamic websites are usually a bit slower than static websites because of how much more is being done, behind the scenes, whenever you open a dynamic web page. Also security is at a greater risk when using a dynamic site vs a static.

A static website is a collection of static web pages, the content is hard coded and the same no matter who views it or how many times you refresh it(like a company website). When you go to a static website, the web server shows you and everyone else the same thing. The page layout and content look and feel the same way for all users. Static websites have a speed advantage over dynamic websites because they don’t have any type of processing to do! Static websites also offer more security compared to a dynamic website mainly because of how simplistic they are. There really isn’t much to play around with when a web server is just showing you plain HTML pages!

Personally, I don’t believe one is better than the other. Like a lot of things in programming, there's a situation that suits each use case. The best thing to do is analyze the type of website you’re building then see whether a static or dynamic website would be a better fit!

I hope you enjoyed this post, thanks for stopping by!

Discussion (0)

Editor guide