3D model embed code generator
Get copy-paste code that shows a 3D model on any website with Google’s model-viewer: drag to rotate, auto-rotate, zoom and view in AR on phones. Free.
Drop a .glb or .gltf here
For a .gltf, drop its .bin and texture files with it. The file stays on your computer.
No model yet? Generate one free from text<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.4.0/model-viewer.min.js"></script>
<model-viewer
src="your-model.glb"
alt="A 3D model"
camera-controls
auto-rotate
ar
ar-modes="webxr scene-viewer quick-look"
shadow-intensity="1"
touch-action="pan-y"
style="width: 100%; height: 480px;"
></model-viewer>Paste it into any HTML page, or a site builder’s “custom code” block. The .glb must be online at that address, and allow cross-origin requests if it’s on another domain.
How to embed a 3D model on a website
- 01
Put your GLB online
Upload the .glb to your site, a CDN or any host that serves files publicly. Paste its address here.
- 02
Pick the options
Auto-rotate, drag to rotate, AR, size, background, shadow and lighting. Drop the file in the viewer to check it.
- 03
Copy the code
Paste it into your HTML, or a “custom code” block in Webflow, WordPress, Wix, Shopify or Squarespace.
Questions about embedding 3D
What is model-viewer?
An open-source web component from Google for showing 3D models in a web page. One script tag loads it; the <model-viewer> tag shows the model.
Why doesn’t my model load?
The .glb must be reachable at its URL, and if it’s on another domain, that host must allow cross-origin requests (CORS). Use the Preview button: if it loads here, it will load in model-viewer.
Does AR work on iPhone?
Yes. model-viewer makes the USDZ iOS needs for AR Quick Look automatically; you can also give your own USDZ file under More.
Will it slow my page down?
The script is about 300 KB compressed and the model loads after the page. Keep GLBs small; the GLB compressor can help.
Is anything uploaded to viya3d?
No. The code is generated in your browser, and a dropped file is only used for the preview.