#webdev #hosting #beginners #tutorial
How to Publish a Website for Free (4 Easy Options)
Raymond Busuttil · Jul 28 · 8 min read

You can publish a website for free in a few minutes if your site is made of plain files. Static hosts serve HTML, CSS, JavaScript and images, and several of them cost nothing for a personal or small business site. This guide compares four free options, then walks through the quickest route in AI Code Zero: one click to a live surge.sh address with HTTPS, with optional password protection and your own domain.
Whether you built the site with AI, by hand or in another tool, the same idea applies: get your files onto a host, and the host gives you a public address.
In short
- A static site (HTML, CSS, JavaScript, images) can be hosted for free by services such as Surge, Netlify, GitHub Pages and Cloudflare Pages.
- In AI Code Zero, click Publish, sign in to a free Surge account, choose an address, and your site is live with HTTPS in seconds.
- You can add a password, a site icon, an install-as-app prompt, and later your own domain (beta).
- You can always export your site as a single HTML file or a ZIP and host it anywhere else.
What do you need to publish a website?
Three things: the site's files, a host that serves them, and an address. A host is simply a computer on the internet that sends your files to visitors. A static site needs nothing more than that, which is why free hosting is possible. There is no database to run or server code to maintain.
What you cannot host this way is anything that needs its own server, such as a custom back end. For common needs like a contact form, extensions connect to outside services so your static site can still collect messages. We cover that in how to add a free contact form.
What are the best free ways to publish a website?
These four all work for a static site. Free plans have limits and terms that change, so check each service's current terms before you rely on one.
| Option | How you publish | Good for |
|---|---|---|
| Surge (via AI Code Zero Publish) | One click from inside AI Code Zero, with a free Surge account | The fastest route from an AI Code Zero project to a live HTTPS address |
| Netlify Drop | Drag your .html file or unzipped folder onto the page | Quick uploads with no tooling |
| GitHub Pages | Put your files in a repository | Sites you want kept in version control |
| Cloudflare Pages | Connect a repository | Sites that live in a repository and need a flexible host |
If you already keep your site in a Git repository, GitHub Pages or Cloudflare Pages fit naturally. If you just want a link to send to someone, a drag-and-drop host or AI Code Zero Publish is quicker.
How do you publish a site from AI Code Zero?
Publish works for apps, websites and games built in AI Code Zero. If you have not made a site yet, our beginner's guide to making a website with AI takes you from prompt to preview. Then:
- Open the Publish window. In the preview toolbar, click Publish (the globe at the right end).
- Sign in to Surge. New to Surge? Click Create an account, enter your email and a password, type it again, then click Create account. Already have one? Keep I have an account selected and click Sign in.
- Choose the web address. AI Code Zero suggests a name. Keep it or type your own, using lowercase letters, numbers and dashes. The address ends in
.surge.sh. - Pick any options. All are optional, and AI Code Zero remembers them for each project.
- Click Publish. After a few seconds you will see Your site is live. Click Copy to copy the link or Open site to visit it.
Your address always uses HTTPS, the padlock that keeps the connection secure. Your Surge password goes to Surge once and is never saved by AI Code Zero. The step-by-step reference is in the publishing documentation.
What options can you set when you publish?
- Site icon. Add the small picture shown in browser tabs and bookmarks. A square image works best. If you do not add one, your site shows the AI Code Zero icon, unless the page already sets its own.
- Let search engines find this site. On by default. Switch it off while the site is a draft: AI Code Zero then asks search engines to leave it out of results. That is a polite request, not a lock, so anyone with the link can still open the site.
- Prompt visitors to install as an app. Invites visitors to add your site to their phone or computer. Our PWA guide shows how installing works on iPhone, iPad, Android and desktop.
- Password protect this site. Covered in the next section.
If you want your site to show up in search, the built-in SEO tool (Settings → Tools) can add titles, descriptions, share previews and structured data, and, when you give your website address, a sitemap.xml and robots.txt at publish time. It cannot promise a ranking, but it covers the basics that our free AI website builder guide recommends.
Can you password protect a free website?
Yes. Turn on Password protect this site, enter a password of at least 10 characters, and repeat it. Visitors then see a lock screen and need the password to get in.
- The pages are locked on your device before upload. Your password is never uploaded or saved.
- Everything is hidden until the password is entered, including your pictures. Only the site icon is public.
- Visitors enter the password once per browser tab.
- Updating the site asks for the password again, because AI Code Zero does not keep it.
- A password-protected site is always kept out of search results.
One honest caveat: a static host cannot lock anyone out after wrong guesses, so someone could try many passwords offline. Use a long password, such as four random words. And unless you add a password, anyone with the link can see your site, so do not publish anything private.
How do you update or unpublish a site?
After you change your project, the button reads Update. Open it and you have three choices:
- Update site replaces what is online with your latest version, at the same address. You can change the icon, search, install and password options here too. New versions can take a minute to appear everywhere.
- Publish to a different address puts a second copy online at a new address. The old one stays up until you unpublish it.
- Unpublish takes the site offline. The link stops working and your project stays in AI Code Zero.
Be aware that someone else could claim a .surge.sh address after you free it, since addresses are first come, first served.
How do you use your own domain?
If you own a domain such as mybakery.com, you can publish to it instead of a surge.sh address. Surge hosts custom domains for free and adds HTTPS for you. Custom domains are in beta.
- In the Publish window, click Use a domain I own next to Web address.
- Type your domain, such as
www.mybakery.com, then click Publish. - Add the DNS record the window shows in the DNS settings at the company where you bought the domain.
| Your address | Type | Name | Value |
|---|---|---|---|
www.mybakery.com | CNAME | www | geo.surge.world |
mybakery.com | A | @ | 138.197.235.123 |
Two things can hold you up. If your DNS is at Cloudflare, turn the orange cloud beside the record grey, which means DNS only. And Surge holds a custom domain until you verify your account, so click the link in Surge's email (the Publish window can resend it). The window checks your DNS every 30 seconds while it is open, and DNS changes can take up to a day. Once the record works, Surge gets a free HTTPS certificate on its own, usually within a few minutes.
What are the limits of free publishing?
- Surge addresses are first come, first served. If yours is taken, pick another name.
- A custom domain can be on only one Surge account.
- If Surge refuses because you published too often, wait a few minutes.
- Your site's images can total at most 60 MB.
- Imported React + Vite projects cannot be published from AI Code Zero. Export them instead.
- Surge's terms apply to what you publish.
Can you host your AI Code Zero site somewhere else?
Absolutely. Click the download button next to Publish (or Update) to export. A one-page app, site or game downloads as a single .html file, and a multi-page website downloads as a .zip with one HTML file per page. Unzip it and index.html is your home page. Upload those files to Netlify Drop, GitHub Pages, Cloudflare Pages or any host that serves plain files. Some pages load libraries such as Tailwind CSS from the internet, so they need a connection to display fully. See the exporting guide for details.
Frequently asked questions
Is Surge really free?
Publishing from AI Code Zero uses a free Surge account and gives you a free surge.sh address with HTTPS. Surge hosts custom domains for free too. Check Surge's own terms for current limits.
Can I publish without an AI Code Zero account?
Yes. AI Code Zero needs no account of its own. You only need a free Surge account, which you can create inside the Publish window.
Will search engines find my site?
They can, if Let search engines find this site is on. It is on by default for new sites. Switch it off for drafts. A password-protected site is always kept out of results.
What happens to my site if I stop using AI Code Zero?
It stays online at its address until you unpublish it, and you can export the files at any time and host them yourself, since the output is ordinary HTML, CSS and JavaScript.
Publish your first site today
If you have a site idea, build it, click Publish and share the link. AI Code Zero is free and open source and needs no AI Code Zero account. Download the desktop app for Windows (Microsoft Store) or Linux (.AppImage and .deb), install it on a Mac in one click through Pinokio with the Mac guide, or open the web app in your browser. Want a head start on the site itself? Try our free AI app builder overview.