# Static site hosting

> What static site hosting is, what you can and cannot do with it, and where to host a static site for free or low cost.

Source: https://comparehostingonline.com/hosting-for/static-sites/

## Short answer

A static site is made of pre-built HTML, CSS and JavaScript files that a host simply serves, with no server code running. That makes static sites fast, secure and cheap to host; you can put them on any web host or on a free static hosting tier.

Last verified Nov 28, 2026 · [How we test](https://comparehostingonline.com/methodology/)

## How a static site works

Built ahead of time

1.  **Site generator** Astro, Eleventy, Hugo
2.  **Finished files** HTML, CSS and JavaScript
3.  **Any host or CDN** Simply serves the files
4.  **Fast pages** No server code to wait for

## What it can and cannot do

### Works well

Content

Blogs, docs and marketing sites

Interaction

Portfolios and landing pages

Delivery

Fast global delivery with a CDN

### Needs something extra

Content

Search (use a client-side index or service)

Interaction

Contact forms (use a form service)

Delivery

User accounts and logins

## Where to host it

-   **Any shared host** Upload the built files to the public folder.
-   **Static platforms** Connect Git and deploy on every commit; many have free tiers.
-   **A VPS** Serve the files with a web server such as Nginx.

Check **bandwidth and build limits** on free tiers, whether **commercial use** is allowed, and what happens when you exceed a limit.

## How do you deploy a static site?

1.  1
    
    **Build the site**
    
    Generate the files with your tool.
    
2.  2
    
    **Upload or connect git**
    
    Copy files or let a platform build.
    
3.  3
    
    **Set the domain and HTTPS**
    
    Point DNS and enable a certificate.
    
4.  4
    
    **Set caching and redirects**
    
    Use long cache times for assets.
    

## What should you check?

-   Free tier limits for bandwidth and builds.
-   Redirect, header and form support.
-   CDN coverage; see [what a CDN is](https://comparehostingonline.com/guides/what-is-a-cdn/).
-   How preview deployments work.

## When do you need more than static hosting?

When you need server-side logic, a database or user accounts. Add serverless functions or use a server; see [hosting for Node.js](https://comparehostingonline.com/hosting-for/nodejs/) and [hosting for portfolio sites](https://comparehostingonline.com/best/hosting-for/portfolio/).

## How do the main hosting options compare?

| Option | Good for | Notes |
| --- | --- | --- |
| Static platform with git deploys | Developers who want previews and automation | Free tiers; limits on builds and bandwidth |
| Object storage with a CDN | Cheap, scalable file hosting | You set up redirects, headers and HTTPS |
| Classic shared hosting | Simple uploads by SFTP | Fine for small sites; few automation features |
| A VPS with a web server | Full control | You manage the server |

## How do you add forms, search and dynamic features?

A static site has no server code, but you can add features with services and functions. Use a form service or a serverless function for contact forms, a search index built at deploy time or a hosted search service for search, and a headless CMS for editing; see [hosting a headless CMS](https://comparehostingonline.com/hosting-for/headless-cms/). Keep secrets out of client-side code and check each service’s limits and pricing.

## What caching headers should you set?

Give fingerprinted assets, files whose names change when content changes, a long cache lifetime, and give HTML a short one or require revalidation, so updates appear quickly while images and scripts stay cached. MDN’s guide to HTTP caching explains the headers, and a CDN, covered in [what a CDN is](https://comparehostingonline.com/guides/what-is-a-cdn/), follows them.

## What are the common mistakes?

-   Caching HTML for too long, so updates do not appear.
-   Forgetting redirects when URLs change; see [subdomain vs subfolder](https://comparehostingonline.com/guides/subdomain-vs-subfolder/) for migration steps.
-   Putting secrets in client-side code.
-   Ignoring a platform’s bandwidth or build limits until a bill arrives.
-   Leaving the custom domain without HTTPS; see [what an SSL certificate is](https://comparehostingonline.com/guides/what-is-an-ssl-certificate/).

## Sources and further reading

-   [MDN: HTTP caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching)
-   [web.dev: Content delivery networks](https://web.dev/articles/content-delivery-networks)
-   [Astro: deploy your site](https://docs.astro.build/en/guides/deploy/)

## Common questions

What is the cheapest static hosting?

Many platforms have free tiers, and any basic web host works.

Do static sites need a CMS?

Not necessarily. You can edit files or use a headless CMS.

Is static hosting fast?

Yes, files are served directly, often from a CDN.

Can a static site have a contact form?

Yes, through a form service or a serverless function.

How do I update a static site?

Rebuild and redeploy, ideally automatically from git.

## Related

[Astro hosting](https://comparehostingonline.com/hosting-for/astro/) [Free hosting](https://comparehostingonline.com/free-hosting/)

## More hosting by stack

[Docker hosting](https://comparehostingonline.com/hosting-for/docker/) [Hosting for n8n (self-hosted automation)](https://comparehostingonline.com/hosting-for/n8n/) [Python and Django hosting](https://comparehostingonline.com/hosting-for/python-django/) [Ruby on Rails hosting](https://comparehostingonline.com/hosting-for/ruby-on-rails/) [Go (Golang) hosting](https://comparehostingonline.com/hosting-for/go/) [WordPress hosting for developers](https://comparehostingonline.com/hosting-for/wordpress/)

MH

**[Muhammad Hamza](https://comparehostingonline.com/team/muhammad-hamza/)** Founder & Editor

Writes and signs off every comparison, and runs the compliance reviews. Has worked on SOC 2 and HIPAA compliance programs for companies.

Our [editorial policy](https://comparehostingonline.com/editorial-policy/) and [testing method](https://comparehostingonline.com/methodology/) are public.
