What is the difference between static and dynamic web applications?
A static site ships pre-made files unchanged, while a dynamic site builds its content on the fly for each visitor.
The split is about when the HTML a visitor sees is produced. With a static site, every page already exists as a finished file sitting on the web server; the server just hands it over byte-for-byte. A personal portfolio or a restaurant's homepage is the classic example. With a dynamic site, a program assembles the page at runtime, so two people can get two different results from the same address.
| Aspect | Static | Dynamic |
|---|---|---|
| Content | Pre-produced files | Generated per request |
| Interactivity | None | User can search, order, log in |
| Examples | Portfolio, brochure site | Amazon shop, web mail (outlook.office.com) |
| Technologies | HTML, CSS | + JavaScript, PHP, a database |
Dynamic content can be produced in three ways (often combined): on the server (e.g. PHP querying a database), on the client (JavaScript running in the browser), or by calling out to a web service.
Gotcha: the line is blurry. Most real sites are hybrids — static assets like images and CSS served as files, with the surrounding page generated dynamically.