GGB File Documentation
Summary
A GeoGebra Document (.ggb) is an interactive maths worksheet, a construction of geometry, algebra, graphs and calculus made in the free GeoGebra software. Its MIME type is application/vnd.geogebra.file. Open it in GeoGebra Classic on any platform, or with no install at geogebra.org/classic. Internally it is a ZIP archive: rename it to .zip to see the geogebra.xml that describes the construction. Export to PDF, PNG or SVG for a static picture.
Technical details
| Feature | Value |
|---|---|
| Full name | GeoGebra Document |
| File extension | .ggb |
| MIME type | application/vnd.geogebra.file |
| Format type | ZIP container holding XML construction data plus a preview image |
| Container / base format | PKZIP (same structure as .zip) |
| Payload | UTF-8 XML (geogebra.xml) validated against ggb.xsd |
| Developer | GeoGebra (International GeoGebra Institute) |
| Introduced | 2001 (GeoGebra 1.0) |
| Original author | Markus Hohenwarter (master’s thesis project) |
| Magic number (hex) | 50 4B 03 04 (ASCII PK) |
| Byte order | Little-endian (ZIP records) |
| Identifying entry | geogebra.xml inside the archive |
| Preview | geogebra_thumbnail.png |
| Optional scripting | geogebra_javascript.js (runs in the GeoGebra sandbox) |
| Open standard | Partial — container is ZIP; schema is published, format is vendor-controlled |
| Cross-platform | Same file opens in desktop, web and mobile GeoGebra apps |
| Related extensions | .ggt (custom tool), .ggs (slides) |
| Specification | geogebra.github.io/docs/reference/en/File_Format/ |
What is a GGB file?
GGB is the native file format of GeoGebra, free interactive mathematics software first written by Markus Hohenwarter in 2001 as a master’s thesis project and now developed by the International GeoGebra Institute. GeoGebra combines dynamic geometry, algebra, a spreadsheet, graphing, statistics and calculus in one program, used widely in schools and universities. A .ggb file stores a complete construction: the points, lines, functions, sliders and equations of a worksheet, together with the dependencies between them, so the file reopens fully interactive rather than as a flat picture.
A GGB is not a single document but a small ZIP archive, so it starts with the ZIP magic bytes 50 4B 03 04 and its MIME type is application/vnd.geogebra.file. Inside, the mathematics is stored as plain XML text. Everything below is about that internal layout and how GeoGebra records a construction so it can be replayed.
The ZIP container and its entries
Rename a copy of a .ggb to .zip, open it, and you find a handful of predictable entries:
geogebra.xml the construction (required)
geogebra_thumbnail.png preview image shown in file browsers
geogebra_javascript.js optional global worksheet scripting
geogebra_defaults2d.xml default styles for new 2D objects (when present)
geogebra_defaults3d.xml default styles for new 3D objects (when present)
geogebra_macro.xml user-defined tools, if the file uses any
images/ (or similar) any pictures placed on the canvas
The single required entry is geogebra.xml; the rest are optional. The thumbnail is what a file manager or the GeoGebra Materials site shows as a preview without opening the whole construction. Any images the author dropped onto the drawing are embedded in the archive rather than linked, so the file is self-contained. Because the archive is a standard ZIP, each entry is DEFLATE-compressed independently and the whole file carries a central directory index like any other ZIP.
geogebra.xml: how a construction is encoded
The heart of the file is geogebra.xml, a UTF-8 XML document whose root element is <geogebra> and which validates against the published schema at geogebra.org/ggb.xsd. It records not just the objects but the application state and the exact steps that built the construction. The document splits into two important parts: a <construction> section listing the mathematical objects, and surrounding sections (<euclidianView>, <kernel>, <gui>) that store the view settings such as the coordinate ranges, axis styling and window layout.
Two kinds of object appear in the construction. A free object is one the user placed directly and is written as an <element> with its type, label and value. A dependent object is computed from others and is written as a <command> (with input and output labels) followed by the <element> that holds its result. The order of these entries is the construction’s step order, so GeoGebra can rebuild the worksheet by replaying them and can walk forwards and backwards through the construction protocol.
<construction title="" author="" date="">
<element type="point" label="A">
<coords x="1" y="2" z="1"/>
<show object="true" label="true"/>
</element>
<element type="point" label="B">
<coords x="4" y="3" z="1"/>
</element>
<!-- a dependent object: the line through A and B -->
<command name="Line">
<input a0="A" a1="B"/>
<output a0="f"/>
</command>
<element type="line" label="f">
<coords x="-1" y="3" z="-5"/>
<lineStyle thickness="5" type="0"/>
</element>
</construction>
Free objects, dependent objects and the dependency graph
The split between <element> and <command> is what makes a GGB dynamic rather than static. Point A above is a free element with explicit coordinates. Line f is not stored as fixed geometry alone; it is defined by a Line command whose inputs are the labels A and B. GeoGebra’s kernel reads these commands into a dependency graph, so when the user later drags point A, the kernel re-evaluates every object that depends on A, and line f moves with it. The coordinates written next to f in the XML are the last computed values, a cached result; the true definition is the command. This is why editing the raw XML is risky: change a cached coordinate without updating the command that produced it and GeoGebra will simply recompute it on the next save, overwriting your edit.
One format across desktop, web and mobile
The same .ggb file opens in every GeoGebra app: the desktop GeoGebra Classic on Windows, macOS and Linux, the browser version at geogebra.org/classic, and the Android and iOS apps. Because the construction is stored as portable XML, a file made in the web app opens unchanged in the desktop app and the reverse, with no conversion step. That portability is the practical reason a teacher can build a worksheet on one device and a student can open it on another. The XML also carries a version stamp, which is why a file saved in a much newer GeoGebra build can occasionally fail to open in an old one; the fix is to update to the current GeoGebra Classic.
GGT and GGS: tools and slides
Two sibling formats reuse the same ZIP-plus-XML design. A .ggt is a GeoGebra custom-tool file: it packages a user-defined tool (a reusable macro built from a construction) as geogebra_macro.xml, so it can be imported into other worksheets. A .ggs is a GeoGebra slides file, bundling several linked activities into one presentation. All three share the container and schema conventions, so the techniques for inspecting a .ggb, renaming to ZIP and reading the XML, apply to them too.
Exporting a construction as an image or PDF
The interactivity that makes a GGB useful is also what stops it embedding in an ordinary document, so GeoGebra exports flattened copies from its File menu. The graphics view can be saved as PNG at a chosen resolution or DPI, as an SVG vector for print and high-resolution use, or as a PDF page. Each of these discards the dependency graph and keeps only the current picture, so the maths is no longer live. To keep a construction interactive but publish it on the web, GeoGebra instead exports an HTML page or embed that runs the construction through the GeoGebra applet, which loads the same XML in the browser.
Frequently asked questions
Can I open a GGB file without installing anything?
Yes. Go to geogebra.org/classic in any browser and use the menu to open or drag in your .ggb file. The web app runs the same construction as the desktop program and needs no download, which is the quickest way to view a worksheet someone sent you.
Why does GeoGebra undo my edits to geogebra.xml?
Because most values in the XML are cached results of commands, not the definitions themselves. A dependent object stores the last computed coordinates next to the command that produces it; when GeoGebra re-saves, the kernel recomputes those values from the commands and overwrites hand-edited ones. To change a construction reliably, edit it inside GeoGebra rather than in the XML.
References
- GeoGebra Manual — File Format reference
- GeoGebra Manual — XML tags in geogebra.xml
- GeoGebra Classic (web app)
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.