:

PRIVATE BROWSER TOOL

Convert BIN firmware to Intel HEX

Set the flash load address explicitly, choose a conservative record size and download a checksum-valid Intel HEX file.

01

Inputs

● Local processing — this file never leaves your browser.
02

Results

:

Run the tool to see a structured report here.

ON THIS DEVICE

Recent history

Your latest 10 runs will appear here on this device.

HOW IT WORKS

Method and formulas

Binary bytes are emitted as type 00 records. Type 04 extended linear address records are inserted whenever the upper 16 address bits change, followed by a type 01 EOF record.

Accuracy note

Always compare generated firmware with the target device’s memory map, linker output and programming documentation before flashing.

GUIDE

What This Tool Does

The BIN to Intel HEX converter transforms a raw binary firmware image into Intel HEX format records. It accepts a base address and record length as parameters. Binary data is packaged into type 00 data records. Extended linear address records of type 04 are generated automatically when the upper 16 bits of the 32-bit address change. A final type 01 end-of-file record terminates the output. Engineers use this conversion when target programmers or bootloaders expect Intel HEX rather than raw binary files for microcontrollers such as STM32, AVR, or legacy 8051 devices. The tool processes every byte sequentially without reordering or inserting padding, ensuring the resulting ASCII file contains exact checksums calculated per the Intel specification. Output lines follow the standard colon-prefixed format with byte count, address offset, record type, data payload, and two's-complement checksum.

When to Use BIN to Intel HEX Conversion

Raw BIN files contain only data bytes without address information. Many in-circuit programmers and flash utilities require explicit address records to place firmware at the correct memory location. Converting to Intel HEX supplies those addresses while preserving exact byte values. Typical scenarios include updating bootloader code at offset 0x08000000, placing application firmware at 0x08008000, or preparing data for EEPROM programmers that interpret HEX records directly. The process preserves every byte order and value from the original BIN file. Additional use cases arise when migrating legacy 8051 projects to modern IDEs that only accept HEX, or when preparing multi-segment images for devices whose flash starts above the first 64 KB boundary. Because BIN files lack metadata, conversion is mandatory before using tools that enforce address validation during programming.

Worked Example

Consider a 64-byte BIN file whose first four bytes are 0x12, 0x34, 0x56, 0x78. The chosen base address is 0x08000000 and record length is 16 bytes. The converter emits one type 04 record for the upper address 0x0800, followed by four type 00 records each carrying 16 bytes. The final type 01 record closes the file. The resulting HEX output begins with :020000040800F2 and continues with data lines such as :1000000012345678... followed by the EOF marker :00000001FF.

OffsetHex BytesRecord TypeFull HEX Line
0x000012 34 56 78 ...00:1000000012345678...
0x0010Next 16 bytes00:10001000...

Second Worked Example

A 32-byte BIN file starts with bytes 0xAA 0xBB 0xCC 0xDD at base address 0x00010000 using record length 8. The converter first outputs a type 04 record :020000040001FB because the upper address differs from zero. Four type 00 records then follow, each holding eight data bytes with correct lower-16 addresses and checksums. The sequence ends with :00000001FF. This example demonstrates automatic insertion of an extended linear address record when crossing a 64 KB boundary and shows how shorter record lengths increase total line count while still reproducing the original byte sequence exactly.

Formula and Method Table

Input ParameterUnitRangeOutput Effect
Base Address32-bit hexadecimal0x00000000–0xFFFFFFFFDetermines starting linear address for first type 00 record
Record Lengthbytes1–255Sets maximum data bytes per type 00 record
BIN File Sizebytes1–1048576 typicalProduces corresponding number of type 00 records plus required type 04 records
Output FormatASCII HEXStandard IntelLines end with checksum; final line is type 01
Checksumbyte0x00–0xFFTwo's complement of sum of all preceding bytes in record
Address calculation: linear_address = base + byte_offset; upper_16 = (linear_address >> 16) & 0xFFFF; lower_16 = linear_address & 0xFFFF

Units and Conversion Notes

QuantityUnitTypical ValuesNotes
Addressbyte address0x00000000–0xFFFFFFFFAlways treated as 32-bit linear
Record lengthdecimal bytes16, 32, 64, 128, 255Never exceeds Intel specification limit
Checksumhex byteCalculated per recordSum of bytes modulo 256 subtracted from 256
File sizebytesUp to 1 MB commonEach 16-byte record adds one ASCII line
Upper address16-bit value0x0000–0xFFFFChanged only via type 04 records

Addresses are always treated as byte-granular 32-bit values. Record length is expressed in decimal bytes; the tool never exceeds the supplied length even when remaining data is shorter. Checksums follow the standard two’s-complement rule: sum of all bytes in the record modulo 256, subtracted from 256. Extended linear address records appear only when the upper 16 bits differ from the previous record, minimizing unnecessary output lines. No data padding or alignment is performed; the exact BIN byte sequence is reproduced verbatim inside the data records.

Limitations

The converter does not validate whether the chosen base address falls inside valid flash regions of any specific microcontroller. Files larger than available browser memory may fail to process. Record lengths above 255 bytes are rejected because Intel HEX specification limits data records to 255 bytes. Type 02 or type 05 records are never generated; only type 00, 04, and 01 appear. The output assumes little-endian byte ordering inside each record exactly as supplied in the BIN file. No support exists for segmented addressing schemes or for inserting custom comments. Processing halts on malformed input without attempting recovery. Large files may produce thousands of lines that exceed the input buffer of certain legacy programmers.

Common Mistakes

  • Selecting a base address that overlaps protected bootloader memory can cause the device to reject the image after programming.
  • Using a record length of 1 byte produces excessively long output files that some older programmers cannot buffer.
  • Forgetting that type 04 records update the address window leads to incorrect placement when the base address crosses a 64 KB boundary.
  • Supplying a BIN file that already contains Intel HEX data results in double encoding and corrupted firmware.
  • Omitting verification of generated checksums before flashing allows silent corruption to reach the target device.
  • Choosing record lengths that are not multiples of common flash page sizes can slow programming on page-oriented hardware.
  • Assuming the converter will insert start-linear-address records (type 05) causes bootloaders expecting entry-point information to fail.

LONG-FORM ANSWERS

Frequently asked questions

How does the converter decide when to insert a type 04 extended linear address record?

A type 04 record is emitted each time the upper 16 bits of the running 32-bit address differ from the previous record. This occurs automatically whenever the base address plus cumulative offset crosses a 65536-byte boundary.

What record length produces the most compact yet still standard-compliant HEX output?

A record length of 32 or 16 bytes balances line count against checksum overhead. Lengths of 255 bytes minimize total lines but may exceed buffer sizes in older programming hardware.

Does the tool support base addresses above 0xFFFF0000 for 32-bit microcontrollers?

Yes, any 32-bit value from 0x00000000 to 0xFFFFFFFF is accepted. Type 04 records correctly encode the high word even when the address lies in the upper half of the 4 GB space.

What happens if the supplied BIN file size is not a multiple of the chosen record length?

The final type 00 record simply contains the remaining bytes; its byte count field reflects the shorter length while the checksum is still calculated correctly.

Can the converter produce Intel HEX suitable for direct EEPROM programming at address 0x0000?

Set the base address to 0x00000000 and any record length up to 255. The resulting file will start loading at EEPROM offset zero without additional offset records.

How are checksum errors prevented during conversion?

Each output line includes a freshly computed checksum derived from the exact bytes written. The algorithm follows the Intel specification exactly, eliminating manual checksum calculation.

What production risk arises from choosing an incorrect base address?

Firmware may be written to an unintended flash sector, overwriting the bootloader or leaving the application at an unmapped address, rendering the device unbootable until external recovery is performed.

Is there a practical upper limit on BIN file size for reliable browser-based conversion?

Files up to roughly 1 MB convert without issue in modern browsers. Larger images may exhaust JavaScript heap memory before all records are generated.