Static website
A website whose pages are built ahead of time, so when someone visits, the server simply hands over ready-made files.
On this page
What does “static” mean?
A static website is made ahead of time. HTML is the file that holds a page’s content so a browser can read it. When someone visits the address, the server sends that ready-made file straight over instead of building a fresh page on the spot. A server is simply a computer that stays on to store files and hand them out.
Imagine making a class poster ahead of time and leaving a stack of copies by the door. Whoever walks by grabs an identical copy. A static website works the same way.
Whether a site is static depends on whether the page is made ahead of time—not on whether it has buttons or animations.
What happens when you open a static website?
Start with the simplest case: your browser has not saved a copy of this page yet. A browser is the app you use to view websites, like Chrome, Safari, or Edge.
- Make the pages ahead of time: the author writes the files, or a tool generates them before anyone visits.
- Put the files on a server: upload the HTML, styles, pictures, and scripts to a server—a computer that stays on to hand out files.
- Ask for the page: someone opens the web address, and their browser asks the server, “Please send me this page.”
- Receive and draw the page: the server sends back the ready-made HTML file as is. The browser reads it, fetches the style files, pictures, and scripts it needs, and shows the finished page.
Sometimes your browser or a CDN saves a copy of the page so the next visit can reuse it without asking the server again. A CDN is like local branch shops that keep files closer to you. Using a CDN or not does not decide whether a website is static.
Look at a tiny website
A simple personal site only needs three files. You do not need to memorize the code—just notice each file’s job.
portfolio/
├── index.html
├── style.css
└── script.jsindex.html: the skeleton of the page, holding the title, text, and button.style.css: the clothes of the page, setting colors, text sizes, and layout.script.js: the tiny brain of the page, making the button react when clicked.
Here is a super simple web page. Even if code looks new, you can spot one big heading, one button, and a line that connects script.js:
<h1>Hello, world!</h1>
<button id="counter">Clicks: 0</button>
<script src="script.js"></script>This short script adds 1 to the number on the button every time you click it:
const button = document.querySelector("#counter");
let clicks = 0;
button.addEventListener("click", () => {
clicks += 1;
button.textContent = `Clicks: ${clicks}`;
});When you click the button, only the number inside your browser changes. The HTML file sitting on the server never changes, so the site is still static.
Static pages do not have to be written one by one by hand. A tool can combine articles and templates ahead of time to build many pages at once, like stamping out greeting cards from one mold.
Try it: a static page can still be clickable
Click the button on the page and watch “Number on page” go up. Then click “Open page again” and see which number changes.
Server
Page files made ahead of time
index.htmlstyle.cssscript.js
Server sent page: 1
Browser
Hello, world!
This page was made ahead of time and saved as files.
Number on page: 0
Server sent page 1 times. Number on page: 0.
When you click the button, only the number on the page changes. Choosing “Open page again” fetches the same ready-made file, so the number resets to 0.
Clicking the button only changes the number inside your browser; the server does not send a new page. Clicking “Open page again” is like grabbing a fresh copy of the original file, so the count goes back to 0. Real websites can also save that number in your browser to pick up where you left off.
How are static and dynamic websites different?
This table compares how the server hands you the page when you open a link. A database is like a giant, neatly organized warehouse for storing data.
| Compare | Static website (made ahead of time) | Dynamic website (made on the spot) |
|---|---|---|
| When the page is made | Before anyone visits | Right when someone opens the link |
| What the server does | Finds the ready-made file and sends it | Runs a program to assemble the page and sends it |
| Where the content comes from | Written in when the page was built | Looked up from a database or another service during the visit |
| How to update content | Edit or rebuild the files, then upload them again | Change the data in the database, and the next visit shows it |
One website can mix both: public intro pages can be made ahead of time, while personal account pages are built on the spot after you sign in. A static page can also fetch fresh data (like today’s weather) after opening—like holding a printed class schedule and checking the board for today’s changes.
When is a static website a good fit?
If a site is mainly for reading and most visitors see the same first screen, a static website is a great fit.
- Personal sites and portfolios: introduce yourself, show off projects, and share contact info.
- Blogs, tutorials, and guides: the author writes pages ahead of time for everyone to read.
- Product and event pages: share public info, with optional animations or mini-tools.
Ready-made files are easy to store and deliver everywhere, so a crowd of visitors will not easily slow them down. Real speed and cost still depend on image sizes, scripts, and how many people visit.
Signing in, posting comments, paying for items, checking live stock counts, or saving forms all need backend programs and a database. Static HTML files alone cannot do those jobs.
Common things people get wrong
Does “static” mean the website can never change?
No. The author can edit the files and upload them again anytime. “Static” describes how the server hands out a ready-made file—not that it never updates. Think of a bulletin board you can redraw whenever you like.
Does a static website need no server at all?
It still needs one. The files need a place to live and something to hand them out—a server or CDN. It just skips cooking fresh pages on the spot, like a convenience store clerk handing you a snack off the shelf.
Can a static website never use a database?
It can. A database is a warehouse for information. Your build tool can read from it when creating the pages ahead of time, and after the page opens, the browser can also ask another service for fresh data. Keep “getting the initial page” and “fetching fresh data later” separate.
Can you put passwords or secret keys inside web page files?
Never. Anyone can inspect the files sent to their browser—that would be like taping your house key to the front door. Anything secret must stay on a server.
Quick quiz
A portfolio site builds all its HTML pages ahead of time. Once opened, it shows animations, filter buttons, and today’s weather. Is it still a static website?
Yes. When someone opens the link, the server sends a page that was already built. The animations, filters, and weather lookup happen inside the browser afterward.
Remember this question: When someone opens the page, does the server send a ready-made file or assemble a new one on the spot?
Read further
These official guides are great if you want to learn more.