Why convert ASTRO to HTML?
Astro is a build tool, not a runtime, so its whole job is to compile .astro components down to pre-rendered HTML for fast, framework-free pages. People want the raw .html files to deploy to static hosts, archive a page, or drop the markup into another system.
How to convert ASTRO to HTML
Astro CLI build FREE
In your project run npm run build (which calls astro build). Astro writes static .html files plus hashed CSS/JS into the dist/ directory by default.
astro build with custom outDir OPEN-SOURCE
Set outDir in astro.config.mjs or run astro build --outDir ./out to place the generated .html in a folder of your choice.
About these formats
An .astro file is a component template for the Astro web framework. It holds HTML-style markup plus an optional JavaScript or TypeScript script section, and Astro compiles it to plain HTML…
Open .ASTRO details →An HTML file is a web page - plain text with markup tags that a browser turns into the formatted page you see. To view it, double-click and it opens in your browser (Edge, Chrome, Firefox,…
Open .HTML details →Quality & what to watch
- The output is the rendered result, not your source -
.astrofrontmatter, components and imports are compiled away into flat markup. - Pages using server-side rendering (
output: 'server') or dynamic routes won't pre-render to static.htmlwithout a static adapter orgetStaticPaths. - HTML references external hashed CSS and JS files in
dist/; a single saved page can break styling unless you keep those assets.
Frequently asked questions
Where does Astro put the HTML files?
dist/ folder by default, with each route as its own index.html (for example about/index.html).Can I get one self-contained HTML file?
Do interactive components still work in the HTML?
client:* directive; otherwise you get static markup with no client-side behavior.Which command builds the site?
npm run build, which runs astro build under the hood.