What is the UF2 file format?
UF2 stands for USB Flashing Format, a file format Microsoft created in 2017 for its MakeCode (PXT) platform. It is built to flash microcontrollers over USB Mass Storage: the board shows up as an ordinary removable drive, and you copy firmware to it like any other file. The specification is open and published by Microsoft under an MIT license.
A .uf2 file is a flat sequence of 512-byte blocks. Each block is self-contained - it carries a 32-byte header with magic numbers, the target flash address, the payload length, the block's index and total count, and a family ID that identifies the target chip, followed by up to 476 bytes of firmware and a trailing magic number. That design solves a real problem: an operating system may write the blocks of a copied file in any order, so making each block independent lets the board's bootloader flash data the moment it arrives, without ever seeing a partial file.
Most people meet UF2 when programming a hobbyist or educational board. The Raspberry Pi Pico (RP2040), BBC micro:bit, and many Adafruit, Arduino, and Seeed boards accept UF2, and it is how CircuitPython and MakeCode projects get installed. You usually get a .uf2 by exporting it from an editor such as MakeCode or by downloading a prebuilt firmware for your exact board. Related firmware formats you may see include raw .BIN images and Intel .HEX files.
Security & safety
RISK: MEDIUMA UF2 file is passive data and cannot run on your PC, but flashing firmware rewrites a board's program memory. Only flash a .uf2 that is built for your exact board, and only from a source you trust, since the wrong or malicious firmware can leave a board unusable until you reflash a known-good image.
Format details
in a nutshellPrograms that open UF2 files
.uf2 file onto that drive. uf2conv.py firmware.bin -o firmware.uf2, or inspect a UF2 with uf2conv.py -i firmware.uf2. .uf2 file onto the removable drive the board presents in bootloader mode. .uf2 file onto it. python3 uf2conv.py firmware.bin -o firmware.uf2 to build or inspect UF2 files. Technical details
deep spec| Encoding | binary |
| Byte order | little-endian (all 32-bit fields) |
| Container | flat sequence of independent 512-byte blocks |
| Typical size | a few KB to about 1 MB |
| Structure | A series of 512-byte blocks; each has a 32-byte header (magic numbers, target flash address, payload size, block index and count, family ID), up to 476 bytes of firmware payload, and a trailing magic number |
| Versioning | flags and 32-bit family-ID field identify the target chip (for example RP2040) |
| Integrity | three magic numbers per block (0x0A324655, 0x9E5D5157, 0x0AB16F30) validate each block; no CRC |
| Platforms | Windows, macOS, Linux, ChromeOS |
| Initial Release Full | 2017, with Microsoft MakeCode |
| Notes | You do not open a UF2 to view it; you copy it onto the board's USB drive to flash firmware. Because each 512-byte block is self-contained, the operating system can write the blocks in any order and the bootloader still flashes correctly. |
| Released | 2017 (Microsoft MakeCode / PXT) |
| Open standard | Yes · royalty-free |
| Specification | github.com |
UF2 conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about UF2 files.
Frequently asked questions
How do I open a UF2 file?
.uf2 file onto that drive. The board flashes it and restarts.How do I put a Raspberry Pi Pico into bootloader mode?
.uf2 onto it and the board reboots running the new firmware.Can I convert a UF2 file to BIN?
uf2conv.py extracts the raw binary with uf2conv.py file.uf2 -c -o file.bin. Keep track of the flash address stored in the UF2 header.