What is a BGCODE file?
A BGCODE file is Prusa's binary G-code: the same printer instructions as a .gcode file, packed into compressed blocks together with thumbnails and print metadata. It does not open here directly. To preview one, convert it to plain G-code in PrusaSlicer with File → Convert, then drop the .gcode on the G-code viewer.
| File extension | .bgcode |
|---|---|
| Type | Binary G-code (printer instructions in compressed blocks) |
| Developed by | Prusa Research |
| First released | Introduced with PrusaSlicer 2.7.0 |
| Encoding | Binary blocks; Deflate or Heatshrink compression, MeatPack encoding, optional CRC32 checksum |
| MIME type | — |
| Opens in 3dfiles | No – convert it to plain .gcode in PrusaSlicer, then use the G-code viewer |
How to open or convert a BGCODE file
- In PrusaSlicer use File → Convert, which converts binary G-code to ASCII G-code and the other way round.
- Drop the resulting .gcode on the G-code viewer to check layers, travel moves, print size and filament length.
- Without PrusaSlicer: libbgcode comes with a command-line program.
bgcode my_gcode.bgcodewritesmy_gcode.gcode. - To stop getting binary files, switch the feature off in PrusaSlicer: for one printer in the Printers tab under General → "Support binary G-code", or for all profiles under Configuration → Preferences → Other → "Use binary G-code when the printer supports it". Then export again.
About the BGCODE format
Prusa describes binary G-code as "a new standard for encoding and compressing ASCII G-code files". According to its help page, PrusaSlicer exports it by default from version 2.7.0 for printers that support it (the MINI, MK4 and XL from firmware 5.1.0), and in Prusa's own tests the files are about 70 % smaller on average than the same G-code as text.
The format is published: the specification and libbgcode, the library that reads, writes and converts it, are on GitHub. A file starts with the four letters GCDE in a 10-byte header and continues with blocks of six kinds: file metadata, G-code, slicer metadata, printer metadata, print metadata and thumbnails. Blocks can be compressed with Deflate or Heatshrink, and G-code blocks can be MeatPack-encoded.
What a BGCODE file looks like inside
Layout of a .bgcode file (binary)
File header (10 bytes)
GCDE magic number
1 version
0 or 1 checksum type: none or CRC32
Block types
0 File metadata
1 G-code
2 Slicer metadata
3 Printer metadata
4 Print metadata
5 ThumbnailOpened in a text editor, a .bgcode shows the letters GCDE followed by unreadable bytes. That is how to tell it from ordinary G-code, which is readable text from the first line.
Common problems
OctoPrint, Klipper or another print server will not take it
Prusa's help page warns that external printer control programs such as OctoPrint may have trouble with binary G-code and advises switching the feature off in PrusaSlicer. OctoPrint's own file types and the G-code extension lists of Klipper and Moonraker do not include .bgcode. For OctoPrint there is a BGCode plugin that converts the file to text on upload.
This site says the file is "binary printer G-code"
The viewer reads text G-code only. Convert the file as described above and drop the .gcode.
Questions about BGCODE files
Can I convert BGCODE to STL?
No. Like any G-code it holds nozzle paths, not the model. Ask for the STL, 3MF or STEP it was sliced from.
Is BGCODE only for Prusa printers?
The format is published openly, but Prusa introduced it and its help page lists support for the MINI, MK4 and XL from firmware 5.1.0. For another printer, export or convert to plain G-code.
How much smaller is a BGCODE file?
About 70 % smaller on average, according to Prusa's own testing.
Which programs open BGCODE?
PrusaSlicer and its standalone G-code Viewer preview it. This site does not; convert it to .gcode first.