picotool is a suite of tools and a Python library for manipulating Pico-8 cartridges.

The tool suite includes commands for gathering statistics, inspecting contents, minifying or formatting Lua code, and searching for strings in the Lua code of multiple carts. The tools can read .p8.png carts as well as .p8 carts.

The picotool library can read .p8 and .p8.png cartridges, and can save .p8 cartridges. It includes a full Lua parser tailored to match Pico-8, with Python access to the token stream and AST. Other libraries provide read/write access to graphics, music, and sound data, as well as arbitrary access to cartridge binary data.

The p8upsidedown tech demo uses the picotool library to invert a cartridge's graphics, map, music, and controls so that the cart plays upside down. This demo modified both the data and the code to accomplish this effect.