How to Open and View a .scad File Online
To view a .scad file online, open the OpenSCAD Playground and drag the file onto it. You can also open Files and choose Import files / ZIP. The playground makes the uploaded file the entry file and shows its source. With Auto on, it previews the model. If Auto is off, select Preview. Nothing needs to be installed. The model compiles in your browser with OpenSCAD 2025.01.19 (Manifold backend) running as WebAssembly.
What a .scad file is
A .scad file is OpenSCAD source code. It is plain text that describes a model with primitives like cube() and cylinder(), transforms, and boolean operations. It does not contain the triangles of a 3D model. To see the shape, OpenSCAD has to run the code. A text editor shows only the code.
An .stl file is the opposite. It is a finished triangle mesh. It has no variables, modules, or parameters. The usual workflow is to edit the .scad source, then export an .stl for your slicer. Going back from an STL to editable OpenSCAD code is not automatic.
Open a single .scad file
Here is a small file you could save as box.scad:
// Open-top storage box. Change the values in Parameters.
/* [Size] */
// Outside width, in millimeters
width = 40; // [20:80]
// Outside depth, in millimeters
depth = 30; // [20:60]
// Outside height, in millimeters
height = 15; // [5:40]
/* [Walls] */
wall = 2; // [1:0.5:4]
difference() {
cube([width, depth, height]);
translate([wall, wall, wall])
cube([width - 2*wall, depth - 2*wall, height]);
}
The result is a 40 × 30 × 15 box with 2-unit walls and an open top. The comments in /* [Size] */ form and the trailing // [min:max] ranges are standard Customizer syntax. The playground turns them into sliders in its Parameters panel. Changing a slider does not rewrite your file. The values are saved with the project and in share links.
When you import one .scad file, it is added to the current project and becomes the entry file. Files that already exist in the project are kept. If a file with the same name already exists, the playground asks before replacing it. Your work is autosaved in this browser. Use Export ZIP for a portable backup.
Preview, render, and export STL
- Preview (Ctrl/Cmd+Enter or F5) makes a draft mesh with
$previewset to true. Auto previews again after each edit. - Render (F6) makes the final mesh with
$previewset to false. Use it to check the shape you will export. - Export → Download STL compiles the current project, including parameter values, and downloads an STL named after the entry file. An imported
box.scadbecomesbox.stl. Download 3MF is also available. It is geometry only, uses millimeters, and has no colors. Download .scad source saves the code.
Preview in the browser is not desktop OpenCSG preview. Colors and the #/% debug modifiers are not shown in the 3D viewport. If a file only makes 2D shapes, such as square(), circle(), or text() without extrusion, switch the playground to 2D. You can then export SVG or DXF. STL needs 3D geometry.
Open a project with include or use
Many .scad files load other files. For example, include <parts/knob.scad> or use <parts/knob.scad>. The playground can only read files that are in the project. Select the main file and every file it loads in one import, or drop them all at once. Here is a two-file project:
// main.scad
use <parts/knob.scad>
for (i = [0:2])
translate([i * 25, 0, 0])
knob(d = 20, h = 12);
// parts/knob.scad
module knob(d = 20, h = 12) {
cylinder(d = d, h = h * 0.6, $fn = 48);
translate([0, 0, h * 0.6])
cylinder(d1 = d, d2 = d * 0.6, h = h * 0.4, $fn = 48);
}
The link opens both files and renders three knobs in a row. Some details matter when you import files yourself:
- Folders are not kept when you pick files. An uploaded
knob.scadis saved asknob.scadat the project root, notparts/knob.scad. Select the pencil next to it in Files and rename it toparts/knob.scadso the path matches theuseline. The other option is to change the line touse <knob.scad>. The playground also searches the project root, so this works from any project folder. - The entry file does not change when you import several files. The first imported
.scadfile opens in the editor, but the project keeps its previous entry file. Select Use as entry file under your main file. - Only ZIPs exported by this playground can be imported. The ZIP must contain the playground's
openscad-project.jsonmanifest. A ZIP downloaded from a model site will be rejected. Extract it and import the.scadfiles and any assets instead. - Assets used by
import()orsurface()can be imported the same way. Examples include.stl,.svg,.dxf,.png, and.datfiles. You can also import.ttfand.otffont files.
Missing library files
If a file is not in the project, OpenSCAD shows a warning in the console and continues. It does not stop with an error. When the same example is opened without parts/knob.scad, the console shows:
WARNING: Can't open library 'parts/knob.scad'.
WARNING: Ignoring unknown module 'knob'
The model is empty, so there is nothing to draw or export. A missing include shows Can't open include file '...'. To fix it, add the missing file with the same relative path, or correct the path in the source.
Libraries that come with desktop OpenSCAD, such as MCAD, are not installed in the playground. Import the library's .scad files into your project, keeping the paths your code expects. One exception: BOSL2 is built in. Check Enable BOSL2 in Files and keep include <BOSL2/std.scad>.
When the file opens but nothing renders
- It is a library file. A file that only defines
modules and functions draws nothing until a module is called. Open the file that calls those modules and make it the entry file, or add a call at the end. - A dependency is missing. Look for
Can't openwarnings and "unknown module" warnings, as described above. - It is 2D. Switch to 2D. STL export needs 3D geometry.
- Parameters are missing or invalid. The Parameters panel only lists simple top-level assignments that come before the first
{in the file. Computed values, such asinner = width - 2*wall;, are left out. Preview and export stay disabled until invalid parameter fields are fixed. - It uses a font you don't have. Only Lato, fonts chosen from the Fonts list in Files, and imported
.ttf/.otffiles are available totext().
Open a .scad file on your computer
Install desktop OpenSCAD and use File → Open. Press F5 to preview, F6 to render, and use File → Export to save STL. Desktop OpenSCAD also has a Customizer panel for the same parameter comments. Because a .scad file is plain text, you can read or edit it in any text editor. You still need OpenSCAD or the playground to see the 3D shape.
Try it: open the storage box example, set wall to 3.5 in Parameters, then select Export → Download STL.
Related guides
- How to Cut Holes in OpenSCAD with difference()
- How to Make Cylinders and Circles Smoother in OpenSCAD
- OpenSCAD examples and lessons
- OpenSCAD cheatsheet
Reference: OpenSCAD manual: include and use.