Intel HEX to BIN Converter
Turn an Intel HEX firmware file into a raw .bin image. Every record type is decoded, every checksum is checked, gaps are filled with the byte you choose, and the file never leaves your browser.
How to Use
- Drop a
.hexfile on the box, click it to pick one, or paste the records into the text area. - Choose the fill byte for gaps between data blocks. 0xFF matches erased flash and EPROM.
- Choose where the .bin starts: at the lowest data address (like
objcopy -O binary) or at address 0. - Check the readouts and the Problems list: bad checksums, wrong byte counts and overlapping records are reported with their line numbers.
- Press Download .bin. If the data sits in separate regions far apart, save each region from the Regions table instead.
Worked Example
One data record, taken apart: :10010000214601360121470136007EFE09D2190140
10 = 16 data bytes · 0100 = address 0x0100 · 00 = data record · 21 46 01 36 01 21 47 01 36 00 7E FE 09 D2 19 01 = the data · 40 = checksum.
Checksum: 10 + 01 + 00 + 00 + 21 + 46 + … + 19 + 01 = 0x3C0. The low byte is 0xC0, and 0x100 − 0xC0 = 0x40, which matches.
An STM32 file. The first line, :020000040800F2, is an extended linear address record: the upper 16 bits of every following address are 0x0800. Its checksum is 0x100 − (02 + 00 + 00 + 04 + 08 + 00 = 0x0E) = 0xF2. A data record at offset 0x0000 therefore lands at 0x08000000. The STM32 sample above holds 32 bytes, so the .bin covers 0x08000000 to 0x0800001F and must be flashed at 0x08000000.
The common mistake: filling gaps with zeros. The “Gap to fill” sample has 16 bytes at 0x0000 and 8 at 0x0020. The 16 bytes between them (0x0010–0x001F) should be 0xFF, the value of erased flash. Filled with 0x00, the 40-byte .bin no longer matches what a programmer reads back from the chip, so a checksum of the image and of the chip disagree.
Show Work
Formulas
How Intel HEX Works
Intel HEX stores binary data as lines of text. Every line is a self-contained record with its own byte count, address and checksum, so a damaged line can be spotted on its own. Because the byte count is a single byte, a record holds at most 255 data bytes; most toolchains write 16 or 32 per line.
The address field is only 16 bits, enough for 64 KiB. Larger address spaces use extension records that set the upper part of the address for the records that follow: type 02 gives an 8086-style segment (multiplied by 16), and type 04 gives the upper 16 bits of a 32-bit address. A file for an 8-bit chip needs only types 00 (data) and 01 (end of file). These rules are set out in Intel’s Hexadecimal Object File Format Specification (Revision A, 1988).
Types 03 and 05 do not hold data at all: they record where execution should begin (CS:IP for an 8086, a 32-bit address otherwise). A .bin has no place to store that, so this converter shows the start address but does not write it into the image. A .bin also has no addresses, which is why the flashing tool must be told where it goes.
About This Converter
This converter reads all six Intel HEX record types, checks the byte count and checksum of every line, follows type 02 and 04 address changes, fills gaps with the byte you pick and builds the binary image. Problems are listed with line numbers instead of being skipped silently: a bad checksum shows the value the line should have, and overlapping records say which line wins.
Everything runs in your browser. The HEX file is never uploaded and the .bin is created as a local download, so it is safe for unreleased firmware. The memory map shows where the data sits, how much is fill, and the entry point if the file has one.
It is meant for embedded developers, repair technicians and anyone feeding a programmer that only accepts raw images.
Related tools: Hex Editor, CRC Calculator, and Checksum Calculator.
Frequently Asked Questions
What is an Intel HEX file?
A text file that describes binary data, usually firmware, one record per line. Each line starts with a colon, then a byte count, a 16-bit address, a record type, the data and a checksum, all written as hex digits. Microcontroller toolchains and EPROM programmers have used it for decades because it is plain text and every line can be checked on its own.
How is the Intel HEX checksum calculated?
Add every byte of the record from the byte count to the last data byte, keep the low 8 bits, and take the two's complement: (0x100 − low byte) AND 0xFF. For :020000040800F2 the bytes 02 + 00 + 00 + 04 + 08 + 00 add up to 0x0E, and 0x100 − 0x0E = 0xF2. A correct record adds up to 0 mod 256, checksum included.
Should gaps be filled with 0xFF or 0x00?
For flash and EPROM, 0xFF: that is what an erased cell reads, so the .bin matches what a programmer reads back from the chip. GNU objcopy fills gaps with 0x00 unless you pass --gap-fill 0xFF, which is a common reason two images of the same firmware differ.
Where does the .bin start, and why can it be huge?
A .bin has no addresses, so it starts at the lowest address in the HEX file and you give that address to the flashing tool. STM32 code starts at 0x08000000, so the .bin must be written there. If a file also holds data far away, such as option bytes or EEPROM contents, one .bin covering both would be mostly fill; save each region separately instead.
Is my firmware uploaded anywhere?
No. The file is read and converted by JavaScript in your browser, and the .bin is created as a local download. Nothing is sent to a server, so it is safe to use with unreleased or proprietary firmware.
How do I use the Intel HEX to BIN Converter?
Simply type or paste your value and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Flashing an STM32
A build that starts with :020000040800F2 puts its code at 0x08000000. Convert it, then write it with st-flash write firmware.bin 0x8000000.
EPROM Programmers
Many programmers want a raw image the size of the chip. Start the .bin at address 0 and fill with 0xFF; a 27C256 holds 32 KiB, so a full image is 32,768 bytes.
Fixing a Hand-Edited HEX
Changed a byte in a record by hand? The Problems list gives the line number and the checksum it should now have, such as 68 instead of 69.
Comparing Two Builds
Two HEX files can hold the same bytes in different line lengths (16 or 32 data bytes per record). Convert both and compare the .bin hashes instead of the text.
Last updated: