# How to add a 3D model to a website

Put the model at a public HTTPS address, allow browser access with CORS, then add the free STL Viewer iframe to your page. Use GLB when you need fast loading and textures.

## 1. Prepare the model

Use the simplest format that keeps what visitors need:

- **STL** for one shape.
- **3MF** for a print with parts and colors.
- **GLB** for fast viewing and textures.
- **STEP** when visitors need to measure a technical part. It also loads a larger CAD reader.

Remove private parts and data. Anyone who can view the file can normally download it. Reduce triangles and texture sizes that do not improve the view.

## 2. Host it over HTTPS

Use your web server or public file storage. The address must return the model itself, not a page with a download button.

The server also needs to allow access from the viewer's site. For a public model, add this response header:

```
Access-Control-Allow-Origin: *
```

Do not use this setting for private files. For login-protected models, build a viewer with your own access checks.

## 3. Add the viewer

Use the [embed builder](https://stlviewer3d.com/embed-3d-viewer/) to enter the address, choose a theme and copy the code. It looks like this:

```
<iframe src="https://stlviewer3d.com/embed/?src=https://example.com/part.stl"
  title="3D model" width="100%" height="480" style="border:0"
  loading="lazy" allowfullscreen></iframe>
```

Give the frame a useful title for people who use a screen reader. Add the main size, material and description as normal text on your page.

## 4. Test it

Check the page on a phone, on a slow connection and in another browser. If the view stays empty, open developer tools and look for a wrong address, HTTP error or CORS message.

## Questions

### Can I use a 3D model from another website?

Only if you have the right to use it and its server allows browser access.

### Will search engines understand the model?

Do not depend on it. Add clear text and an image to your page that describe the object.

Source: https://stlviewer3d.com/guides/embed-an-stl-viewer/
