Can G-Code Be Converted Back to STL?

Posted on
3D Insider is ad supported and earns money from clicks, commissions from sales, and other ways.

Yes, G-Code can be converted back to STL using a few special tools. However, the conversion process is less than perfect and you probably will not recover the STL file completely. To avoid this problem, avoid deleting STL files unless you are absolutely sure that you do not need them anymore.

Before 3D printing a model, the model is converted into a set of machine instructions called the G-Code. It’s not a very common problem, but there may come a time when you will find yourself with the G-Code generated from an STL file that no longer exists. Is it possible for G-Code to be converted back to STL?

The differences between STL and G-Code

programming code

An STL is only one of many formats for digital 3D models. It is also the most commonly used file format for 3D printing because it is a relatively simple representation of a 3D model, resulting in smaller files. Just as with any 3D model, an STL file contains mesh data that defines the model’s precise geometry.

The G-Code is a set of machine-readable instructions that a slicer generates upon processing an STL file or any other 3D model. This is the code that controls 3D printing parameters such as temperatures and printing speeds. More importantly, the G-Code dictates the movement of the print head, making sure that filament is extruded exactly where it should be according to the geometry of the model.

Although the G-Code is generated from the STL, they represent massively different types of data. There are certain intricacies of the model geometry that no longer exist in the G-Code equivalent. There is also no mesh data in the G-Code – at best, it is a series of lines that represent the movement of the print head.

Issues to anticipate

There may be a scenario where you will find yourself in possession of the G-Code for a 3D printing project, but its source STL file can no longer be accessed. When this comes up, you may find yourself wondering if the G-Code you’re holding can be converted back to its STL counterpart.

There are a couple of ways for this to be potentially done, but keep in mind that you will be working with two significantly different datasets. As we mentioned, the G-Code is just a machine language. It may contain traces of the original 3D model, but many of the details become lost during the translation step.

There is also the fact that the G-Code may include instructions for parts that are not in the original STL file. This is often the case for models that require supports, rafts, or brims to be printed. If you manage to convert such G-Code algorithms, the resulting STL file will include parts that will have to be manually cropped out.

The most succinct way to describe the problem is that the G-Code is only an approximation of the source STL. It is practically impossible to do a conversion of G-Code to STL and get an output that is of the same quality as the original STL file. You can repair this if you have skills in 3D modeling or sculpting, but it will take a bit of work.

Best tools for converting G-Code to STL

There are a few software or online tools that have functions designed specifically for the conversion of G-Code to STL. Most of these tools used to be free, but you may now have to pay a subscription fee. There is also a way to do the conversion using a more manual method, which we shall also discuss.



MakePrintable is an online STL repair service. You will have either subscribe to the service or pay per download if you’re just working with a small handful of projects.

One of the tools under the labs section of MakePrintable is the G-Code reverser. As the name implies, this tool allows you to upload a G-Code and create a 3D model based on it. The conversion process can take several minutes depending on the complexity of the model. Models generated by MakePrintable can be saved as either STL or OBJ files.

A huge advantage of using this platform is the fact that it also utilizes the STL repair tools of MakePrintable. Even if the initial model is not perfect, the platform’s tools can help refine it to better simulate how the STL file originally looked like.


GCode2L is an online tool much like MakePrintable that is specifically designed only for the conversion of G-Code to STL files. It is free to use but also has limitations on the size and level of complexity of models that it can process.

Being a free online service, there is no reason to not explore this tool if you’re stuck with G-Code. Due to the platform’s limitations, it is best used for fairly simple models – bowls, vases, and small figures to mention a few good examples.



Voxelizer is a slicer that is used for the Zmorph 3D printers. It may not be one of the more popular slicers around, but it has a unique feature that allows for the conversion of G-Code back to STL.

To get good models from G-Code, the process goes through a step called “voxelization.” With the G-Code as a reference, the slicer creates voxels or small volumetric 3D elements. You can think of voxels as the 3D equivalent of pixels. You have the option of controlling how many voxels will be generated from the G-Code. A higher number of Voxels will create better models but will also take a longer processing time.

An advantage of working with voxels is that they can be manipulated or removed individually. This is a great capability to have if the resulting model from the G-Code contains unwanted artifacts such as brims or support structures. These can be removed easily through the slicer platform. The edited model can then be exported as an STL file.

However, the fidelity of multiple voxels can also be a drawback if the resulting file turns out to have an incredibly large file size. Even small models can be hard to work with if you don’t manage the number of voxels generated during the conversion process.

Voxelizer is free to use if you own a Zmorph 3D printer. If this is not the case, you will have to pay a subscription fee to have a license to use the slicer.

Manual methods

If you want to retain a high level of control over what the resulting model will look like, then you can go through a process that requires a higher degree of manual intervention. This method will require a higher level of skill in 3D modeling.

While you can certainly make a model from scratch, having the G-Code available can help make a guide for you to use as a basis. G-Code can be “read” by some slicers like Cura and the resulting file can be exported as STL. However, this will typically not create an actual 3D model. You will more like end up with a wireframe that approximates what the reference model looked like.

This approach is crude, but that wireframe should have all the information that can help you make a comprehensive 3D model almost from scratch. This is the best option if you want the model to look as good and accurately detailed as possible.

Converting G-Code back to STL is the reverse of the ideal workflow. Considering this fact, you should always manage your expectations when making such a conversion.

Final thoughts

Losing the STL file to a project that you would like to print again can be devastating. However, you might still be able to salvage the situation if you still have the G-Code saved on an SD card that you have lying around.

It’s going to be tough to get good results when converting G-Code back to STL. This is not the ideal scenario, and some geometry data tends to get lost in the G-Code. The G-Code might also contain extraneous details such as supports, rafts, and brims. These cannot be avoided, but are also not impossible to deal with.

The methods we have listed here all vary in terms of cost, effort involved, and effectivity. If you’re willing to do a bit of 3D modeling or voxel manipulation, you’re more likely to produce a model that is close to how the original model looked like. It’s really up to you to decide if the juice is worth the squeeze.

Warning; 3D printers should never be left unattended. They can pose a firesafety hazard.