Which tool for which job
| You want to… | Use | Why |
|---|---|---|
| Convert files in a script, a build step or CI | IfcConvert (part of IfcOpenShell) | One command per file, runs on Windows, macOS and Linux, and can filter which IFC classes to export. |
| Convert one file now, without installing anything | Online 3D Viewer | Opens IFC in the browser and exports glTF or GLB. According to its help page, files from your computer are not uploaded. |
| Convert inside your own JavaScript application | IFClite | Its geometry package has an exportGlb function, so your app can convert without a separate tool. |
| Clean up or restyle the model before exporting | Bonsai in Blender | Open the IFC with Bonsai, change materials or hide elements, then use Blender's own glTF exporter. |
| Stream a large model or a city | xeokit convert or mago 3DTiler | Neither writes a single glTF file: xeokit convert writes XKT for the xeokit viewer, and mago 3DTiler writes OGC 3D Tiles. |
IfcConvert: one command
IfcConvert is the command-line converter of the IfcOpenShell project (LGPL-3.0).
Download it for your operating system from the
IfcOpenShell releases,
or install it with conda or Docker as described in its
installation guide.
The output format follows the file extension, so .glb gives binary glTF 2.0:
IfcConvert model.ifc model.glb
IfcConvert -y -j 4 model.ifc model.glb
IfcConvert model.ifc walls.glb --include entities IfcWall -yoverwrites an existing output file, and-j 4uses four threads.-
--include entities IfcWallexports only walls, including subtypes such asIfcWallStandardCase. Put--includeand--excludeafter the file names: they take a list of values and will otherwise read the file names as class names. - By default IfcConvert leaves out
IfcSpaceandIfcOpeningElement, so rooms and the voids cut for doors and windows are not in the file. --center-modelmoves the model near the origin, which helps with models placed far from 0,0,0.-
Some options do not apply to glTF: its help text says
--y-upis for OBJ and--use-element-guidsfor OBJ, DAE, STP and SVG. glTF output is already Y-up, as the glTF standard requires.
What the glTF file keeps
IfcConvert writes one glTF node per IFC element with its tessellated geometry and surface colours. Each node is named
product-<uuid>-body, where the UUID is the element's IFC GlobalId in its expanded form. Property sets,
quantities, classifications and relationships are not written to the file. glTF is a format for showing models, not for
exchanging BIM data, so keep the IFC file as the source and treat the glTF as a view of it.
The GlobalId in the node name is enough to link the two. When a user clicks an element in a glTF viewer, you can look up its properties in the IFC file. This Python script prints the first elements of a converted model:
import json
import struct
import ifcopenshell
import ifcopenshell.guid
model = ifcopenshell.open("AC20-FZK-Haus.ifc")
with open("AC20-FZK-Haus.glb", "rb") as f:
data = f.read()
json_length = struct.unpack("<I", data[12:16])[0]
gltf = json.loads(data[20 : 20 + json_length])
for node in gltf["nodes"][:3]:
name = node.get("name", "") # e.g. product-a167c520-8800-48d8-a07c-aa352a699dde-body
if not name.startswith("product-"):
continue
uuid = name[len("product-") :].rsplit("-", 1)[0]
element = model.by_guid(ifcopenshell.guid.compress(uuid.replace("-", "")))
print(element.GlobalId, element.is_a(), element.Name) Output for the AC20-FZK-Haus model:
0KMpiAlnb52RgQuM1CwVfd IfcSite Gelaende
38a9vdh9bF5Qg28GWyHhlr IfcStair Wendeltreppe
2XPyKWY018sA1ygZKgQPtU IfcWallStandardCase Wand-Int-ERDG-4 Try it with sample files
The files below are openly licensed and small enough for a first run. Converting them with IfcConvert 0.9.0post1 gave:
- Simple-Scene Building Architecture (IFC4 and IFC4.3): 142 KB of IFC became a 108 KB GLB with 12 elements.
- AC20-FZK-Haus (IFC4): 2.5 MB of IFC became a 1.2 MB GLB with 83 elements (walls, slabs, windows, doors, beams, members, a stair, railings and the site). Its 7 spaces and 17 openings were left out, as described above.
- Every output file passed the Khronos glTF Validator with no errors or warnings.
Tested with IfcConvert 0.9.0post1, IfcOpenShell-Python 0.9.0.post1 and glTF Validator 2.0.0-dev.3.10 on .
Online 3D Viewer: in the browser
Online 3D Viewer (MIT) at 3dviewer.net imports IFC and exports glTF and GLB: open the IFC file, then export the model as GLB. Its help page says files from your computer are processed in the browser and not uploaded. It cannot export back to IFC, and it gives fewer options than IfcConvert, so use it for single files rather than repeated conversions.
IFClite: inside a JavaScript application
IFClite (MPL-2.0) is a toolkit for IFC in the browser, on a server or in a desktop app. According to its
export guide, the
GeometryProcessor in @ifc-lite/geometry has an exportGlb function that always
writes a single binary GLB. This suits a web application that converts IFC to glTF as part of its own workflow.
Bonsai and Blender: edit, then export
Bonsai (GPL-3.0) opens IFC models in Blender. From there, Blender's built-in exporter, under File → Export → glTF 2.0 (.glb/.gltf) according to the Blender manual, writes the scene as glTF. This route is slower to automate than IfcConvert, but it lets you change materials, remove elements or add lights and cameras before exporting, for example for a presentation or a game engine.
Check the result
The Khronos glTF Validator checks a glTF or GLB file against the specification in the browser; the same validator is available as a command-line tool and npm package for CI. A file that passes should open in any glTF viewer, game engine or web 3D library.
Frequently asked questions
Is there a free IFC to glTF converter?
Yes. IfcConvert, Online 3D Viewer and IFClite are free and open source, and Blender with Bonsai can export glTF too.
Does glTF keep the IFC properties?
Not in IfcConvert's output: it keeps geometry, colours and each element's GlobalId in the node name. Use the GlobalId to read properties from the IFC file.
Should I export .gltf or .glb?
GLB is a single binary file and is what IfcConvert writes. A .gltf file is JSON with separate binary and texture files; Blender can write both.
Why is my model rotated or far from the origin?
glTF is Y-up while IFC is Z-up, and IfcConvert handles this for GLB output. If the model is far from the origin, convert again with --center-model.