What is the ASTRO file format?
An .astro file is a component used by Astro, an open-source web framework for content-focused sites such as blogs, documentation, and marketing pages. Fred K. Schott created Astro in 2021, and it reached a stable 1.0 in August 2022. The project is now maintained under the MIT license after Cloudflare acquired the Astro Technology Company in January 2026.
Each file has two parts split by a --- code fence. Above the fence sits the component script, or frontmatter, written in JavaScript or TypeScript. It runs at build time to import other components, fetch data, and declare variables. Below the fence is the template, an HTML-like block that accepts {} expressions, <slot /> placeholders, and scoped <style> and <script> tags. The syntax is a superset of .html and reads much like JSX, though it uses standard kebab-case attributes.
Astro renders components to HTML ahead of time and ships no client-side JavaScript by default. Interactive pieces are added selectively through the islands architecture using client:* directives on framework components.
Security & safety
RISK: LOWAn .astro file is human-readable source text and cannot run on its own by double-clicking. It only executes when compiled by the Astro toolchain during a build. As with any project source, its frontmatter can contain JavaScript, so review files from untrusted repositories before running npm install or a build, since build scripts and dependencies (not the .astro file itself) are the real risk.
Format details
in a nutshell- ASTRO-VISION LifeSign / horoscope data - Some astrology software has used .astro for chart or profile data files. Unrelated to the web framework.
- Generic astronomy/astrology data exports - Occasionally seen as an ad hoc extension for star-chart or ephemeris data in niche tools.
Programs that open ASTRO files
.astro files. .astro components. npm run dev or astro build to compile .astro files into HTML and preview the site. .astro files with full language support. astro dev and astro build in Terminal to run and compile the project. .astro files. npm run dev or npx astro build from the terminal to serve or compile .astro files. Technical details
deep spec| Encoding | UTF-8 plain text |
| Byte order | Not applicable (text) |
| Container | None; single source file |
| Typical size | A few hundred bytes to tens of kilobytes |
| Structure | Two sections separated by a --- code fence: an optional component script (frontmatter) written in JavaScript/TypeScript that runs at build time or on the server, followed by a component template made of HTML-like markup with {} expressions, directives, <slot />, <style> and <script> tags. |
| Integrity | None built in |
| Platforms | Windows, macOS, Linux |
| Notes | Astro components render to HTML ahead of time and ship no client-side JavaScript runtime by default. Interactive framework components can be hydrated selectively using client:* directives (the islands architecture). The Astro compiler parses .astro files and outputs HTML plus any scoped CSS and hydration code. |
| Syntax Basis | Superset of HTML, close to JSX but using standard kebab-case HTML attributes |
| Runtime | Server/build-time rendering; no default client runtime |
| Language Support | JavaScript and TypeScript in the frontmatter, including top-level await |
| Released | 2021 |
| Latest version | Astro 6 (March 2026) |
| Specification | docs.astro.build |
ASTRO conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about ASTRO files.
Frequently asked questions
How do I open an .astro file?
Can I view an .astro file in a browser?
npm run dev or build it with astro build, and Astro turns the component into HTML that the browser then displays.What program creates .astro files?
.astro files.Is an .astro file the same as HTML?
Why does my .astro file have JavaScript at the top?
--- lines, is the component script or frontmatter. It runs at build time to import components, fetch data, and set variables used in the template below.