Introduction

A finished page on your screen is not yet a website. To publish it you need the files themselves, a quick check that they work outside the editor, and a host that serves them. For a site made only of HTML, CSS, JavaScript and images, that host can be free, and the whole process takes a few minutes once you have done it once.

Step 1: Export Your Files

From the HCODX editor

Select Export in the toolbar, or File โ–ธ Export as ZIP. The ZIP contains the same files and folders you see in the file tree, so index.html, your stylesheets, scripts and images keep their relative paths.

From the HTML Runner

Export ZIP downloads a single index.html that loads your CSS and JavaScript, so it works on any static host as it is. The ZIP also contains your original files in a sources folder and a project.json copy of the project.

Check the export before uploading

Unzip the file and open index.html in your browser. If styles or images are missing here, they will be missing online too: the cause is almost always a path that does not match the folder structure. Make sure index.html sits at the top level of the folder you upload, because hosts serve that file when someone visits the site's address.

Platform configuration files

Some hosts read optional configuration files from your upload. Netlify reads netlify.toml, and Netlify and Cloudflare Pages both read _redirects and _headers files for redirect rules and custom response headers. A plain static site does not need any of them.

Preparing Projects for Production

Development code and production code are not the same. Before deploying your HTML project, you should prepare it for the production environment. This preparation phase ensures optimal performance, security, and user experience.

Cleaning Up Development Artifacts

Remove any files and code that were only needed during development. This includes console.log statements in JavaScript, commented-out code blocks, test files, and placeholder content. Production code should be clean, focused, and free of debugging remnants. Search your entire project for TODO comments and address them before deployment.

Validating Your HTML and CSS

Paste each page into the HTML validator to catch unclosed tags, duplicate IDs and missing alt text, and run the published URL through the W3C Markup Validation Service for a full standards check. Similarly, validate your CSS to ensure cross-browser compatibility. Valid code renders more consistently across different browsers and devices. Fix all errors and warnings before deploying, as even minor issues can cause unexpected display problems for your users.

Testing Across Browsers and Devices

Your website might look perfect in Chrome on your desktop, but how does it appear in Safari on an iPhone or Firefox on a tablet? Test your project across multiple browsers and device sizes before deployment. Use browser developer tools to simulate different screen sizes, and if possible, test on actual devices. Pay particular attention to navigation menus, image scaling, and form inputs, as these elements often behave differently across platforms.

Checking All Links and Resources

Broken links frustrate users and hurt your search engine rankings. Before deploying, click every link on your website to verify it leads to the correct destination. Check that all images load properly, all CSS files are linked correctly, and all JavaScript files execute without errors. Use relative paths for internal resources and absolute URLs for external links to ensure everything works once deployed.

Pro Tip

Create a pre-deployment checklist that you follow for every project. Include items like validating HTML, testing responsive design, checking meta tags, verifying image optimization, and confirming that all links work. A systematic approach catches issues that spot-checking might miss.

Optimization Before Deployment

Website performance directly impacts user experience and search engine rankings. Optimizing your project before deployment ensures fast load times and better engagement metrics.

Minifying HTML, CSS, and JavaScript

Minification removes unnecessary characters from your code without changing functionality. This includes whitespace, line breaks, comments, and sometimes variable names in JavaScript. Minified files are significantly smaller than their original versions, which means faster downloads for your users. You can minify a page with the HTML minifier; larger projects usually use a build tool such as Vite or esbuild, which minifies CSS and JavaScript as part of every build. Keep the readable files as the copy you edit.

Optimizing Images

Images often account for the majority of a web page's file size. Before deployment, compress all images using tools like TinyPNG, ImageOptim, or Squoosh. Convert images to modern formats like WebP when browser support allows. Use appropriate image dimensions rather than relying on CSS to resize large images. Implement lazy loading for images below the fold to improve initial page load times.

Enabling Browser Caching

Configure your hosting platform to serve appropriate cache headers. When browsers cache static assets like images, stylesheets, and scripts, returning visitors experience much faster load times. Most hosting platforms allow you to configure caching through configuration files or dashboard settings. Set longer cache durations for assets that rarely change and shorter durations for content that updates frequently.

Compression

Servers can compress text files such as HTML, CSS and JavaScript with gzip or Brotli before sending them, and browsers decompress them automatically. Text usually shrinks to a fraction of its original size. GitHub Pages, Netlify and Cloudflare Pages compress responses for you, so there is nothing to configure; you can confirm it by looking for a content-encoding header in the Network panel of your browser's DevTools.

Deployment Platforms

Choosing the right hosting platform depends on your project requirements, budget, and technical expertise. Here are three popular options that offer free tiers and excellent developer experiences.

GitHub Pages

GitHub Pages is a free hosting service integrated directly into GitHub repositories. It is perfect for static websites, portfolios, documentation sites, and project pages. To deploy on GitHub Pages, push your project to a GitHub repository, navigate to the repository settings, and enable GitHub Pages from the Pages section. Your site will be available at username.github.io/repository-name within minutes.

GitHub Pages supports custom domains and automatically provides HTTPS encryption. The main limitation is that it only hosts static content, so server-side processing is not available. However, for HTML, CSS, and JavaScript projects, this limitation rarely matters. GitHub Pages also integrates with Jekyll for static site generation, though pure HTML projects work perfectly without any additional tools.

Netlify

Netlify has become a favorite among web developers for its powerful features and generous free tier. Deploy by dragging and dropping your project folder into the Netlify dashboard, or connect your GitHub repository for automatic deployments whenever you push changes. Netlify provides instant rollbacks, form handling, serverless functions, and split testing out of the box.

One of Netlify's standout features is its deploy previews. When working with a team, every pull request generates a unique preview URL so stakeholders can review changes before they go live. Netlify also handles redirects, custom headers, and environment variables through its netlify.toml configuration file.

Cloudflare Pages

Cloudflare Pages hosts static sites on Cloudflare's global edge network, so your content loads quickly for visitors everywhere. Deploy by connecting a GitHub or GitLab repository for automatic builds on every push, or upload a project folder directly with the Wrangler command line tool. The free tier includes unlimited sites, unlimited requests, and unlimited bandwidth, and every project gets automatic HTTPS with no extra configuration.

Cloudflare Pages gives you fine-grained control through two plain-text files you place in your project. A _redirects file defines redirect and rewrite rules, and a _headers file sets custom response headers and cache policy. These are especially useful for clean URLs and single-page apps: a path that matches no file would otherwise return a 404, but a _redirects rule can rewrite it to your entry page or send visitors to the correct location. Because both files ship inside your static output, your routing and header configuration stay in version control alongside the site.

Domain Setup and Hosting Options

While free subdomains from hosting platforms work for testing and personal projects, professional websites typically require custom domains. Setting up a custom domain involves registering the domain name and configuring DNS records to point to your hosting platform.

Registering a Domain Name

Purchase your domain from a reputable registrar like Namecheap, Cloudflare Registrar, Porkbun or GoDaddy. When choosing a domain name, keep it short, memorable, and relevant to your content. Check availability across different extensions (.com, .io, .dev) and consider registering multiple variations to protect your brand. Most domains cost between $10 and $20 per year for common extensions.

Configuring DNS Records

After registering your domain, you need to configure DNS records to connect it to your hosting platform. Each platform provides specific instructions, but the process typically involves adding A records that point to IP addresses or CNAME records that point to the platform's servers. DNS changes can take up to 48 hours to propagate globally, though most updates complete within a few hours.

Enabling HTTPS with SSL Certificates

Every website should use HTTPS encryption. Fortunately, platforms like GitHub Pages, Netlify, and Cloudflare Pages issue and renew free TLS certificates for your domain automatically. Once your custom domain is configured, enable HTTPS through your hosting platform's dashboard. Force HTTPS redirects to ensure all visitors access your site securely. HTTPS not only protects your users but also improves your search engine rankings.

Choosing Between Shared and Dedicated Hosting

For most HTML projects, shared hosting or platform-as-a-service options like Netlify and Cloudflare Pages provide excellent value. Dedicated hosting becomes necessary when you need guaranteed resources, custom server configurations, or handle extremely high traffic volumes. Start with shared hosting and upgrade only when your needs genuinely require it. Premature optimization of hosting often wastes money without providing meaningful benefits.

Conclusion

Export, check the unzipped files locally, then upload them to a static host. Once a site is live, publishing a change is the same short loop: edit, export, check and upload, or push to a connected Git repository and let the host deploy it for you.

Ready to Put This into Practice?

Open your project in the HCODX editor and choose Export to download it as a ZIP, ready to upload.

Open the HCODX editor โ†’