Back to the BIM & IFC blog
Tool Guides · 2026-06-03 · 9 min
How to View IFC in the Browser with three.js, web-ifc & Fragments
Loading an IFC into a three.js scene sounds simple until the first 200 MB model freezes the tab for two minutes. The trick the libraries teach is: don't parse IFC at runtime. Here's how web-ifc, Fragments, and a convert-once pipeline actually fit together.
How to View IFC in the Browser with three.js, web-ifc & Fragments — IFC Viewer Online article cover
Rendering IFC on the web is a solved problem — but only if you follow the pattern the libraries are built around. Developers who try the naive approach (load the .ifc, parse it, build meshes, every time) hit a wall on the first real model: the tab freezes for a minute or more while WebAssembly chews through the file. The fix isn't a faster parser; it's parsing once and never again.
The Stack
web-ifc
The WebAssembly core (from That Open) that reads and writes IFC at near-native speed in the browser or Node. The foundation everything else sits on.
Fragments
That Open's optimized geometry format. You convert IFC → Fragments once; loading the .frag afterward is dramatically faster than re-parsing the IFC.
three.js
The WebGL renderer that draws the scene. Fragments produce three.js-compatible geometry you add to a scene, camera, and controls like any other meshes.
The Naive Approach (and Why It Hurts)
import * as WebIFC from "web-ifc";
const api = new WebIFC.IfcAPI();
await api.Init();
// Parsing the raw IFC at runtime — fine for tiny files, painful for real ones
const data = new Uint8Array(await file.arrayBuffer());
const modelID = api.OpenModel(data);
// ...extract geometry, build meshes... (slow, blocks the main thread)
The Production Pattern: Convert Once, Load Many
- Convert the IFC to Fragments a single time (on upload, in a worker, or in a build step).
- Persist the .frag output — in cache, OPFS, or object storage.
- On every load after that, fetch the Fragments and render — no IFC parsing involved.
- Run the heavy work in a Web Worker so the main thread stays responsive.
import * as OBC from "@thatopen/components";
const components = new OBC.Components();
const fragments = components.get(OBC.FragmentsManager);
const ifcLoader = components.get(OBC.IfcLoader);
await ifcLoader.setup();
// First time only: IFC → Fragments
const model = await ifcLoader.load(ifcBytes);
// Serialize once, reuse forever
const frag = fragments.export(model.group);
await saveToCache(frag); // OPFS / IndexedDB / server
// Subsequent loads: skip IFC entirely
const cached = await loadFromCache();
fragments.load(cached); // fast
Common Pitfalls
- "memory access out of bounds": the web-ifc WASM ran out of memory on a big file — convert in a worker, increase available memory, or process in chunks.
- Geometry far from the origin jitters: models authored at true geographic coordinates lose floating-point precision; rebase to a local origin. (See 'IFC Coordinates Are Wrong'.)
- No server-side rendering: web-ifc runs in the browser/Node, not as a no-JS SSR step — plan for client-side or a build-time conversion, not request-time SSR.
- Loading optimization: tile and cull large models so you only draw what's near the camera. (See 'Why Large IFC Files Crash Your Browser'.)
Or Don't Build It
This is exactly the pipeline this viewer runs: web-ifc for parsing, a Fragments-style convert-once step, OPFS caching so repeat loads are ~10× faster, and validation on top. If your goal is to view and check IFCs rather than to build a viewer, you can skip the engineering and just open the file.
See the pipeline in action
A production-size IFC4 model loaded with exactly this convert-once, cached pipeline. Open it, then reload — the second load is near-instant.
IFC4 · 14 MB
Open the interactive IFC viewer
Embed It in Your Own Page
If you host your IFC somewhere public (a CORS-enabled bucket, a raw repo link, or your CDE), you can drop this exact viewer into a blog post, docs page, or CDE panel with a single iframe — no build step. Paste a URL below, tweak the layout, and copy the snippet. The model is fetched in the visitor's browser, so nothing is uploaded to us.
Build your IFC embed
Paste a public IFC URL, choose a layout, and copy the iframe. Live preview updates as you go.
Open IFC Viewer
How to View IFC in the Browser with three.js, web-ifc & Fragments