CompareHostingOnline

Home / Hosting for developers / Static site hosting

Hosting for developers

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.

By Muhammad Hamza, Founder & EditorUpdated Nov 28, 2026

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

How a static site works

Built ahead of time
  1. Site generatorAstro, Eleventy, Hugo
  2. Finished filesHTML, CSS and JavaScript
  3. Any host or CDNSimply serves the files
  4. Fast pagesNo 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 hostUpload the built files to the public folder.
  • Static platformsConnect Git and deploy on every commit; many have free tiers.
  • A VPSServe 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. Build the site

    Generate the files with your tool.

  2. Upload or connect git

    Copy files or let a platform build.

  3. Set the domain and HTTPS

    Point DNS and enable a certificate.

  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.
  • 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 and hosting for portfolio sites.

How do the main hosting options compare?

OptionGood forNotes
Static platform with git deploysDevelopers who want previews and automationFree tiers; limits on builds and bandwidth
Object storage with a CDNCheap, scalable file hostingYou set up redirects, headers and HTTPS
Classic shared hostingSimple uploads by SFTPFine for small sites; few automation features
A VPS with a web serverFull controlYou 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. 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, 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 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.

Sources and further reading

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

More hosting by stack

Esc

Use the arrow keys, then Enter.