What is the HEX file format?
Files with the .hex extension use the Intel HEX format - a plain-text, ASCII record format that encodes compiled binary firmware so it can be reliably transferred to a programmer or flashing tool. Rather than storing raw binary data, every byte of content is represented as two hexadecimal characters, which keeps the file fully human-readable in any text editor.
.hex files are always plain text and can be opened with a standard text editor such as Notepad. To flash the firmware to a microcontroller, specialized tools such as avrdude or Arduino IDE are used. Where raw machine code is needed instead, a compiler can also output a binary .bin image, or a Motorola S-record .srec for systems that prefer that format.
A .hex file is the result of a compiler or assembler converting source code into machine code and then encoding it for safe transfer to the target device.
Where .hex files are used
Data contained within .hex files is used to program microcontrollers and to write content into embedded memories such as EEPROM and Flash storage. Microcontrollers are installed in many commonly used devices - from remote controllers and systems controlling a car engine to modern IoT sensors and robotics hardware.
Structure of data in .hex files
Hexadecimal data in a .hex file is stored in lines of text called records, and each record consists of six fields:
- Start code - a colon (
:) that marks the beginning of every record - Byte count - two hex digits defining the number of data bytes in that record
- Address - four hex digits specifying the 16-bit destination address (addressing up to 64 KB per segment in the base format)
- Record type - two hex digits, from
00to05(for example,00= data record,01= end-of-file) - Data - the actual payload, with each byte encoded as two hexadecimal characters
- Checksum - two hex digits holding the two's complement checksum of all preceding bytes in the record
The final line of every valid Intel HEX file is the fixed end-of-file record :00000001FF.
Security & safety
RISK: MEDIUMA .hex file is plain data and cannot run on your PC by itself, so opening one in a text or hex editor is harmless. The real risk is on the device: flashing untrusted firmware can brick hardware or load malicious code onto a microcontroller. Only flash .hex files from the device vendor or a source you trust, and confirm the file matches your exact board/chip before uploading. Editing firmware bytes by hand can also corrupt the image.
Format details
in a nutshell- Generic hex dump - A human-readable transcript of another file's raw bytes (offset + hex + ASCII columns) produced by a hex editor or tools like xxd/hexdump; sometimes raw binary blobs are also loosely saved as .hex.
Programs that open HEX files
Technical details
deep spec| Encoding | Pure ASCII text; every data byte is represented as two hexadecimal characters |
| Record start character | Colon `:` (0x3A) - every record line begins with this character; there is no binary magic number |
| Record types | Six types numbered 00-05: data (00), end-of-file (01), extended segment address (02), start segment address (03), extended linear address (04), start linear address (05) |
| Base address range | 16-bit addressing per segment, covering up to 64 KB without address extension records |
| Extended address range | Up to 4 GB (32-bit) using type-04 Extended Linear Address records, enabling full 32-bit memory mapping |
| Max data bytes per record | Up to 255 bytes (0xFF) of data per record; common practice uses 16 or 32 bytes per record |
| Checksum algorithm | 8-bit two's complement of all bytes in the record (byte count, address, record type, and data), excluding the start colon |
| End-of-file marker | Fixed record `:00000001FF` must terminate every valid Intel HEX file |
| MIME type | text/plain |
| Address byte order | Big-endian - most significant byte first in address and multi-byte count fields |
| Primary use | Programming Flash and EEPROM on microcontrollers such as AVR, PIC, ARM Cortex-M, and 8051 families |
| Toolchain origin | Output of compilers and assemblers including avr-gcc, MPLAB X IDE, Keil MDK, and IAR Embedded Workbench |
| File size overhead | Approximately 1.4-2× the raw binary size, as each byte of data becomes two ASCII characters plus per-record framing bytes |
| Released | 1973 (Intel HEX format) |
| Open standard | Yes · royalty-free |
| Specification | en.wikipedia.org |
HEX conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about HEX files.