Intel defined the format in its Hexadecimal Object File Format Specification, Revision A (6 January 1988), which describes 8-bit, 16-bit and 32-bit forms; the sources section links a copy. Statements marked convention below are not in that document: they describe what common tools write or accept, taken from the other sources listed there.
The format is older than Revision A. Accounts such as Wikipedia say Intel designed it in 1973 to load programs into its Intellec MDS development systems from paper tape, and added the 8086 segment records around 1978. Revision A gives no dates for this, and we have not checked these two dates against an Intel document.
Record layout
A file is a sequence of records. Each record is ASCII text: a colon, then pairs of
hexadecimal digits, each pair one byte. Intel codes each byte as two ASCII characters,
and the high-order hexadecimal digit always comes first: the byte
0x3F is written 3F, never F3. Addresses are
big-endian (most significant byte first).
Convention: Intel’s text does not say how records are separated, and it
does not give an example of a whole file. Tools write one record per line, ending in CR LF
or LF, and write the digits A to F in upper case (Intel’s text
writes them in upper case). Wikipedia says the line ending is optional, because the
colon is what marks the start of a record, and that a reader should ignore any characters
before the colon. What real readers do differs; see how real readers behave.
The explorer accepts lower case and spaces and reports the spaces.
| Characters | Bytes | Field (Intel’s name) | Meaning |
|---|---|---|---|
| 1 | — | Record mark | : (0x3A). |
| 2 | 1 | Record length (RECLEN) | Number of bytes in the data field, 00 to FF (255 at most). Convention: 16 or 32 bytes per record are common, and some software does not cope with more than 16. |
| 4 | 2 | Load offset (LOAD OFFSET) | For data records, the 16-bit address of the first data byte, relative to the current base address. 0000 in every other record type. |
| 2 | 1 | Record type (RECTYP) | 00 to 05, the six types Intel lists; see record types. |
2 × RECLEN | RECLEN | Data (INFO or DATA) | The bytes the record carries. |
| 2 | 1 | Checksum (CHKSUM) | Makes the eight-bit sum of every byte from RECLEN to the checksum zero; see checksum. |
Record types
| Type | Name | RECLEN | Load offset | Data |
|---|---|---|---|---|
00 | Data record | 0–255 | address of the first byte | The bytes to load. |
01 | End of file record | 00 | 0000 | None. It is always :00000001FF. Convention: it is the last record of the file and appears once (Intel’s text does not say so; Wikipedia does); the explorer reports a record after it, a second one and a missing one. Old 8-bit files differ in two ways: some put the program’s start address in this record’s load offset (see older files), and some CP/M assemblers end the file with a zero-length data record instead. |
02 | Extended segment address record | 02 | 0000 | A 16-bit segment base (USBA). Bits 4–19 of the address of the data records that follow. It may appear anywhere in the file and stays in force until the next one; the base defaults to zero before the first. Valid in 16-bit and 32-bit files. |
03 | Start segment address record | 04 | 0000 | The 8086 start address: two bytes of CS, then two bytes of IP. Optional: it may appear anywhere in the file, and when it is absent a loader is free to choose a default start address. Valid in 16-bit and 32-bit files. |
04 | Extended linear address record | 02 | 0000 | A 16-bit upper linear base (ULBA). Bits 16–31 of the address of the data records that follow. It may appear anywhere in the file and stays in force until the next one; the base defaults to zero before the first. Valid in 32-bit files only. |
05 | Start linear address record | 04 | 0000 | The 32-bit start address (the 80386 EIP), big-endian. Optional: it may appear anywhere in the file, and when it is absent a loader is free to choose a default start address. Valid in 32-bit files only. |
Intel lists these six as the types “currently” defined. Its text does not say what a reader must do with any other type. In our words: the explorer reports it as a problem and ignores the record, and still opens the file. Other vendors did use further types; they are listed under types other vendors use.
The start records only say where execution begins; they do not change the base address of the data records, and no start record is needed for a file to be loaded.
Real mode of the 80386 (Intel, page 9). The text of the Start Linear Address Record
(05) says that the record “only specifies the code address within the 32-bit linear address
space of the 80386” and continues: “If the code is to start execution in the real mode of the 80386,
then the Start Segment Address Record should be used instead, since that record specifies both the CS
and IP register contents necessary for real mode.” So a file for code that starts in real mode carries
a type 03 record, not a type 05 one. The explorer shows whichever start record the
file has and does not check which mode the code runs in.
The three forms
| Form | Other names (convention) | Record types Intel allows | Address space |
|---|---|---|---|
| 8-bit | I8HEX, HEX-80 | 00, 01 | The 16-bit linear address space of the 8-bit processors (64 KiB): the load offset is the address. |
| 16-bit | I16HEX, HEX-86 | 00–03 | The 20-bit segmented address space of the 16-bit processors (1 MiB). |
| 32-bit | I32HEX, HEX-386 | 00–05 (all six) | The 32-bit linear address space of the 32-bit processors (4 GiB). |
Intel lists the data record (00) and the end-of-file record (01) as valid in all
three forms, the extended segment address (02) and start segment address
(03) records as valid in “16- or 32-bit formats”, and the extended linear
address (04) and start linear address (05) records in the 32-bit
format only. So a 32-bit file may use all six types.
Convention: the names I8HEX, I16HEX and I32HEX
(and HEX-80, HEX-86 and HEX-386) are not in Intel’s document; they
come from Wikipedia, which gives I8HEX as types 00 and 01,
I16HEX as 00 to 03 and I32HEX as
00, 01, 04 and 05. (The SRecord package
uses i8hex, i16hex and i32hex only as the address
length to write, 16-bit, 20-bit or 32-bit, in srec_cat; it does not list the
record types for them.) The I32HEX list is the common way 32-bit tools write files,
but it is a habit, not Intel’s rule: a
reader should accept 02 and 03 in a 32-bit file, and the explorer does.
The file does not say which form it uses; a reader learns it from the record types it meets.
Working out addresses
The base address is zero until a type 02 or 04 record sets it. Such a
record may appear anywhere in the file, and its value applies to every data record after it
until the next base record. A start record (03 or 05) does not
change the base. For
data byte number DRI (counting from 0) of a record whose load offset is
DRLO:
| After | Address of the byte |
|---|---|
| no address record | (DRLO + DRI) MOD 64K (our reading: Intel’s Data Record page makes the load offset the address in the 8-bit form; the MOD 64K is the same wrap as for segments, as SRecord’s description has it) |
type 02 | USBA × 16 + ((DRLO + DRI) MOD 64K) |
type 04 | (ULBA × 65536 + DRLO + DRI) MOD 4G |
Intel gives the second and third formulas, and says the sum ignores any carry, so the
address wraps around. In the segment form the offset wraps around inside the 64 KiB
segment: a record at offset FFFE with four bytes puts the last two at offsets
0000 and 0001 of the same segment, not in the next one. In the
linear form the offset carries into the upper 16 bits, and the address wraps from
FFFFFFFF to 00000000. Convention: writers avoid
relying on either wrap and start a new address record at each 64 KiB boundary.
What the explorer does. A data record that passes the end of its 64 KiB range is
reported, and its data continues into the next 64 KiB range (as the objcopy tools do); the segment
wrap inside the segment is not modelled. At the top of the 32-bit address space the explorer does follow
Intel: a byte whose address passes 0xFFFFFFFF is placed at 0x00000000 and
onwards (MOD 4G), and the record is reported. GNU objcopy and llvm-objcopy do not wrap
there: they keep counting beyond 4 GiB (their addresses are wider than 32 bits).
Type 02 and type 04 in the same file
Intel allows both in a 32-bit file (the segment record is valid in “16- or 32-bit formats”) and
gives each its own base: the linear base address (LBA, set by 04) and the segment
base address (SBA, set by 02), each “in effect until another” record of
its own type is met, and each “defaults to zero until” one is met. Revision A has no sentence on
what a file gets when both are in force: it gives the address formula for each base alone
(see the table above), never for both. Our reading of that silence: a record of
the other type is not said to cancel a base, so both stay in force, and the only way for both to be
in force is to add them. That is what the explorer does by default (option “Base records: add”). The three programs
we read give two answers:
| Reader | Where the first data byte lands after 04 0800, 02 1000, then a data record at offset 0000 | Source |
|---|---|---|
| GNU objcopy (binutils) | Adds the bases: 0x08000000 + 0x10000 + 0 = 0x08010000. Also with the records in the other order. | ihex.c lines 399 (segbase = HEX4 (buf) << 4), 435 (extbase = HEX4 (buf) << 16) and 350/373 (extbase + segbase + addr). Its writer zeroes a segment base before writing a type 04, with the comment that the two records are “combined, at least by some readers” (comment on lines 822-827, the zeroing on 828-835). |
| llvm-objcopy | Adds them: 0x08010000. | llvm/lib/ObjCopy/ELF/ELFObject.cpp, IHexELFBuilder::addDataSections: RecAddr = R.Addr + SegmentAddr + BaseAddr; two separate variables, 02 sets SegmentAddr, 04 sets BaseAddr. Run on this example with llvm-objcopy 22.1.8 it gave the same address. |
| SRecord | Replaces: one address_base; the latest record decides. After 04 0800, 02 1000 the byte is at 0x00010000; with the records in the other order, at 0x08000000. | intel.cc lines 248 (address_base = address_field << 4) and 288 (address_base = address_field << 16). Read, not run. |
| The explorer | Option “Base records”. Default add (our reading of Intel, and the two objcopy tools); replace gives SRecord's reading. When a file has both kinds of record, the summary has a “Base records” row that says which reading was used and whether the other one would put the data at other addresses. | The example :020000040800F2 :020000021000EC :020000000102FB is read the same by both objcopy tools and by the default, and differently by SRecord and by the “replace” option. |
Writers avoid the question: files from objcopy never leave a segment base in force when they write a type 04.
Checksum
Add every byte of the record from RECLEN to the last data byte, keep the
lowest eight bits, and take the two’s complement (256 minus the sum, or 0 when the sum
is 0). A reader can check a record by adding all its bytes including the checksum: the
lowest eight bits must be zero.
:0300300002337A1E
03 + 00 + 30 + 00 + 02 + 33 + 7A = E2
0x100 − 0xE2 = 0x1E checksum 1E
check: E2 + 1E = 100, low byte 00
02 33 7A at 0x0030) and its checksum.Examples of every record type
| Record | Meaning |
|---|---|
:10010000214601360121470136007EFE09D2190140 | Type 00: sixteen bytes 21 46 01 … at offset 0x0100. 10 + 01 + 00 + 00 = 0x11 and the data bytes add up to 0x3AF; the total 0x3C0 has low byte C0, so the checksum is 40. |
:00000001FF | Type 01: end of file. The only byte that is not zero is the type, so the checksum is 0x100 − 0x01 = FF. |
:020000021200EA | Type 02: segment base 0x1200, so later data records load at 0x12000 + offset. 02 + 02 + 12 = 0x16; checksum EA. |
:0400000300003800C1 | Type 03: start at CS:IP = 0000:3800. 04 + 03 + 38 = 0x3F; checksum C1. |
:020000040800F2 | Type 04: upper address 0x0800, so later data records load at 0x08000000 + offset. 02 + 04 + 08 = 0x0E; checksum F2. |
:04000005000000CD2A | Type 05: start address 0x000000CD. 04 + 05 + CD = 0xD6; checksum 2A. |
A whole file
:020000040800F2
:10000000000002200D010008110100081301000882
:040000050800010DE1
:00000001FF
0x08000000, sixteen bytes at 0x08000000, start address 0x0800010D, end.The data line: 10 + 00 + 00 + 00 = 0x10, and the data bytes
00 00 02 20 0D 01 00 08 11 01 00 08 13 01 00 08 add up to
0x6E; 0x10 + 0x6E = 0x7E, so the checksum is
0x100 − 0x7E = 82. The start line:
04 + 05 + 08 + 01 + 0D = 0x1F; checksum E1.
Gaps between data records are simply memory the file does not describe; a tool that converts the file to a flat binary has to choose a value to fill them with. Convention (from Wikipedia; it is not in Revision A): the very early specifications, written for paper tape, asked for at least 25 NUL characters before the first record and after the last, as leader and trailer. Wikipedia adds that this was a little-known part of the specification and not all software copes with it, so do not assume a reader skips them: GNU binutils, for one, does not recognise a file as Intel HEX unless its very first byte is a colon (see how real readers behave).
Older files
Start address in the end-of-file record. The SRecord documentation
(srec_intel(5)) says that “in ancient times” the 8-bit form used the load offset of the
end-of-file record for the start address; Revision A codes it 0000. GNU binutils reads it that way: if
the start address is still zero when it meets
the end-of-file record, it takes that record’s load offset as the start address (its source
comment describes the old 8-bit format as having a “transfer address” there, “usually 0000”).
The explorer reports a non-zero offset in this record and shows it as the start address.
Reading stops at the first end-of-file record. binutils stops reading at the first
type 01 record and ignores whatever follows; the explorer reads on and reports
records after it.
Zero-length data record as the end. Wikipedia says most CP/M-80 assemblers (and the
XASM09 assembler for the 6809) do not write a type 01 record at all but end the file with a
zero-length data record (RECLEN 00, type 00), which makes
hex files easy to concatenate. The explorer reports the missing end-of-file record and says
that the file ends this way.
How real readers behave
Our reading of the source of GNU binutils (bfd/ihex.c), a widely used reader,
and of SRecord (intel.cc, its header intel.h and the character reader in
input/file.cc); the first and second were read in full, the other two in the parts quoted below. This is what those programs do, not what the
format requires. binutils reads a file in two stages: first it decides whether the file is Intel HEX at all
(ihex_object_p), and only then does it read the records (ihex_scan).
| Situation | binutils |
|---|---|
| Digit case | Accepts A–F and a–f. |
| Stage 1: is it Intel HEX? | The very first byte of the file must be a colon, and the next eight characters must be hexadecimal digits (byte count, load offset and record type of the first record); otherwise the file is “wrong format”. A leading CR, LF or space therefore already fails here. The first record’s type must also be 00 to 05: a larger type makes the file “not recognised” as Intel HEX, which is a different outcome from the “unrecognized ihex type” error that a later record gets (see “Other types” below). A file shorter than nine bytes is not recognised either. |
| Stage 2: before a colon, between records | Only after stage 1 has passed, the reader loop runs: it skips CR, skips LF (counting lines on LF) and treats a colon as the start of a record; any other character at that point is an error. Because stage 1 has already required a colon at byte 0, the skipping can only ever happen after a record, never before the first one. After a record’s checksum the next character may be a colon directly, so a line ending is not needed; a space or a NUL there is an error. Blank lines between records are therefore fine. |
| Checksum | A wrong checksum is an error. |
Type 00 | Accepted with any length; a zero-length data record adds nothing. |
Type 01 | Stops reading. The load offset becomes the start address if that is still zero (older files). |
Types 02, 03, 04 | The length must be exactly 2, 4 and 2; otherwise an error. Type 03 is added into the start address as CS × 16 + IP. |
Type 05 | Length 4 (the Intel form) or 2, a form its source comments take from “another document”, where the two bytes are the upper 16 bits of the start address. Any other length is an error. The explorer reports a length of 2 because Intel says 4. |
| Other types | In a record after the first: an error (“unrecognized ihex type”), the file is refused, not skipped. In the first record: stage 1 above. |
| No end-of-file record | Accepted: the file simply ends. |
SRecord (as we read intel.cc, intel.h and input/file.cc) differs. SRecord 1.65 was run (26 November 2026): built from the source archive v1.65 (GitHub, 809,393 bytes) with plain c++ by toolchains/build-srecord.sh, without cmake (whose configure step needs Doxygen) and with hand-written config.h and patchlevel.h; srec_cat --version says “1.65.0”. The explorer’s option SRecord reading (Base records: the latest base record only, a record that crosses the end of a segment wraps inside it after a 02 or 03 record, nothing after the end-of-file record is read, and the end-of-file load offset is a start address only before any 02 to 05 record) is checked by parser-test/test-hex-srecord-reading.mjs: 35 cases whose expected result was first worked out by hand from the saved intel.cc and is now measured: every case is also run through the real srec_cat - -intel -o - -motorola (exit status, message on standard error, the data and the start record read back) and all 35 agree with the hand reading (173 checks, none failed). Where SRecord stops with an error (wrong checksum, a space or characters after the checksum, a wrong length, an unknown type, a character that is not a digit) or skips a line (a space before the colon), the explorer loads what it can and reports the problem; the test asserts that report. The one difference it does not report: a file whose lines all end in a lone CR, where SRecord stops (“end-of-line expected”) and the explorer reads the file without a remark.
| Situation | SRecord |
|---|---|
| Lines | A line is read from its first character: a line feed alone is a blank line and is skipped quietly; a line that does not start with a colon is a “garbage line”, skipped with one warning “ignoring garbage lines”. A file with no data record at all is a fatal error (“file contains no data”). |
| End of line | After the checksum the next character must be a line feed, or it stops with “end-of-line expected” (get_char() != '\n' in intel.cc). The character reader in input/file.cc turns CR LF into LF for a text file, which this reader is (the class says it is not binary, and neither intel.h nor intel.cc says otherwise); it leaves a CR that is not followed by LF alone, and adds a final LF if the file ends without one. So, by our reading, CR LF files are accepted, a lone CR is not a line ending, and a missing last line ending is tolerated. We read this; we did not run SRecord. |
| Starting mode | The reader starts in 8-bit mode (mode_t mode{mode_i8hex} in intel.h, whose comments call the other two modes “aka i32hex” for linear and “aka i16hex” for segmented). A type 02 or 03 record switches it to segmented mode, a type 04 or 05 record to linear mode. |
| Data record crossing a boundary | Only in segmented mode (after type 02 or 03): a record whose offset plus length passes 0x10000 is split, and the rest continues at the segment base plus the wrapped offset. Only in linear mode (after type 04 or 05): a record that starts below 4 GiB and ends above it is split, and the rest continues at address 0. In the default 8-bit mode (before any such record) there is no split and no wrap: the record is passed on whole at its address. |
| Load offset | Types 02 to 05 must have a load offset of 0000 (a fatal error otherwise). The end-of-file record’s offset is taken as a start address only in 8-bit mode; in the other two modes a non-zero offset gives a warning. |
| Lengths | Exact lengths: 2 for types 02 and 04, 4 for 03 and 05, 0 for 01 (fatal errors). |
| Checksum | A record whose bytes do not add up to zero is a fatal error when checksum checking is on (use_checksums(); we did not read where that is set). |
| Empty data record | A type 00 record with no data is dropped with the warning “empty data record ignored” (intel.cc 389-392), but it is counted as a data record first (++data_record_count, line 388, just under case type_data: on line 387): a file whose only data record is empty gives no “file contains no data” error (lines 336-339). |
| End-of-file record | Reading stops there: the record sets end_seen and calls seek_to_end() (intel.cc 200-201), so what follows is ignored, as in binutils. Its data length must be 0 (fatal otherwise). A second start record gives the warning “redundant execution start address record” (line 398). |
| No end-of-file record | Only a warning (“no end-of-file record”); the data read so far is kept. |
llvm-objcopy (llvm/lib/ObjCopy/ELF/ELFObject.cpp, IHexRecord::parse, checkRecord,
IHexReader::parse and IHexELFBuilder::addDataSections; the main branch fetched
2026-11-19 into our sources folder, read in full for these functions; the installed 22.1.8 was run on the files below and agrees where we tried it):
| Situation | llvm-objcopy |
|---|---|
| Lines | The file is split at line feeds only (split(Lines, '\n')) and each line is trimmed at both ends with StringRef::trim(), whose default set is space, tab, line feed, vertical tab, form feed and carriage return (the call is Lines[LineNo - 1].trim() in IHexReader::parse; the default set " \t\n\v\f\r" is declared in llvm/ADT/StringRef.h, read from the installed llvm 22 headers). Because the split is at line feed, the line feed in the set never occurs inside a line; an empty line is skipped. So CR LF files and blank lines (also before the first record) are accepted, but a file whose lines are separated by a lone CR is one long line and fails (“invalid character”: a CR or a colon inside the line is not a hexadecimal digit), and a file with no line endings at all fails the same way (the second colon): every record must be a line of its own. A missing final line ending is fine. |
| Characters, length | Starts with a colon; everything after it must be a hexadecimal digit (either case); the line must have at least 11 characters and exactly 11 + 2 × byte count: no extra characters after the checksum, no short record (errors “line is too short”, “invalid line length”). Wrong checksum: error. |
Type 00 | A zero-length data record is refused (“zero data length is not allowed for data records”). (The builder has a branch that ignores empty records, but the checker rejects them first.) |
Type 01 | Reading stops at the first one; its length and load offset are not examined. A file without one is accepted. A file with no data record is an error (“no sections”). |
Types 02, 04 | Length must be 2. The load offset is not checked. 02 sets SegmentAddr = value << 4, 04 sets BaseAddr = value << 16; both are added to the offset (see mixed 02 and 04). |
Types 03, 05 | Length must be 4: type 05 with length 2 is refused (binutils accepts it). A type 03 record is refused unless its first three hexadecimal digits are 000 (“start address exceeds 20 bit for 80x86”), and the four bytes are read as one 32-bit number as the entry address, not as CS × 16 + IP. The load offset is not checked. |
| Other types | Refused (“unknown record type”). |
| Address | R.Addr + SegmentAddr + BaseAddr in 64-bit arithmetic: no wrap at 4 GiB. |
Observed against the installed llvm-objcopy 22.1.8 and GNU objcopy 2.47 (-I ihex -O binary) with 50 generated files (our test, scripts/hex/gen-hex-files.mjs run by parser-test/test-hex-built.mjs): 40 give the same image in both tools and the explorer; the 5 with a zero-length data record are refused by llvm-objcopy only; the 5 with a record crossing 0xFFFFFFFF are placed beyond 4 GiB by the tools and wrapped by the explorer.
Five more readers
Read from single raw source files (saved in our samples/hex/readers folder; none was built or run; where a row says “reads the record from fixed places” that is our reading of the code):
avr8js (demo/src/intelhex.ts, the 11-line loadHex of the AVR emulator, MIT), avrdude (src/fileio.c, ihex_readrec and ihex2b, GPL 2 or later),
OpenOCD (src/target/image.c, image_ihex_buffer_complete_inner, GPL 2 or later),
stm32flash (parsers/hex.c, hex_open, GPL 2 or later) and the Python library IntelHex (intelhex/__init__.py, _decode_record and loadhex, BSD).
esptool was not examined: we did not find an Intel HEX reader in it and did not check further.
| Reader | Lines | Checksum | Length of the record | Types | Base records | End-of-file record | Start address |
|---|---|---|---|---|---|---|---|
| avr8js | Splits at LF; a line counts only if its first character is a colon and the two digits at characters 7 and 8 are 00; a leading space, so, drops the record. A CR is not looked at. |
Not checked. | Reads the record from fixed places (count, 16-bit address, then count bytes); a short line is not noticed (the missing digits read as zero). | Type 00 only; every other type, the end-of-file record included, is ignored. |
Ignored: only the 16-bit load offset is used, so a file with a type 04 record puts everything in the first 64 KiB of the target. | Not a stop: lines after it are still read. | Ignored. |
| avrdude | A line that is empty or does not start with a colon is skipped without a message (a leading space too); a final LF is cut off, a CR stays. | A mismatch is an error (format ihex); only a warning for its more permissive ihxc format. |
Fewer digits than the count needs: “invalid record” (error). Characters after the checksum are not looked at (CR, spaces, anything). | 00, 01, 02, 03 and 05 (the last two accepted and not used), 04; any other type is an error (“do not know how to deal with rectype”). |
One base: a 02 sets value << 4, a 04 sets value << 16, the latest of either wins (as SRecord, unlike the objcopy tools). The record’s length and load offset are not checked. |
Stops reading; a file without one gets only the warning “no end-of-file record”. | Ignored (“We don’t do anything with the start address”). |
| OpenOCD | A line is read with a limit of 1,023 characters; lines that start with # and lines of only spaces, tabs and line ends are skipped; a record must start with the colon in the first place (a leading space: “image format error”). |
Checked over the bytes it read; a mismatch is an error. | The count is not compared with the length of the line (the digits are read with sscanf; a missing one leaves the previous value in place). |
00 to 05; any other type is an error (“unhandled IHEX record type”). |
A record 02 (read as “linear address” and shifted left 4) or 04 replaces the upper bits of the running address; a new section (an entry of its image) starts when the address is not the next one. A section limit applies (IMAGE_MAX_SECTIONS). |
The first one closes the sections; reading goes on after it with the warning “continuing after end-of-file record”; a file with none is an error (“premature end of IHEX file”). | A record 05 sets the start address; a 03 is read and dropped. |
| stm32flash | Reads one character at a time; CR and LF between records are skipped; any other character that is not a colon (a space, so) makes the file invalid. | A mismatch makes the file invalid. | Reads exactly the count; a short record is invalid; characters after the checksum (other than CR and LF) make the next “record” invalid. | 00, 01, 02 and 04 are used; the others (03, 05 and unknown ones) are read and their checksum checked, nothing else (no error for an unknown type). |
The image is one flat buffer from the first base record on; a gap inside a base is filled with FF, a gap between bases with zero; a base below the first one makes the file invalid. Data records that go backwards are not handled (the distance is computed without a sign). |
Stops reading; no end-of-file record is accepted. | Ignored. |
| IntelHex (Python) | Trailing CR and LF are cut off; an empty line is skipped; any other line must start with a colon (a leading space is an error). | A mismatch is an error. | The digits must be an even number and the record must be exactly 5 + count bytes: no extra characters, no short record (errors). |
00 to 05; any other type is an error. Lengths are exact (2 for 02 and 04, 4 for 03 and 05, 0 for 01) and the load offset of 02 to 05 must be zero (errors). |
One offset: a 02 sets value × 16, a 04 sets value × 65536, the latest wins. The code carries the comment that the address “should be wrapped” after a 02 at the 64 KiB boundary and after a 04 at 4 GiB: it is not. |
Stops reading (a library exception caught by the loader); a missing one is accepted. | Kept (CS and IP, or EIP); a second start record is an error. A byte written twice is an error (“address overlap”). |
Where they agree: every reader that checks the checksum treats a wrong one as an error, not a warning (except avrdude’s ihxc format); every one stops at, or after, the first end-of-file record except avr8js and OpenOCD, which read on; no one requires the end-of-file record except OpenOCD. The explorer reports each of these differences as a problem on the record and loads the record anyway.
esptool is a writer, not a reader (Espressif esptool/cmds.py, saved as samples/hex/readers/esptool-cmds.py, 25 November 2026; GPL-2.0-or-later, read for the format only). Its only Intel HEX code is the merge-bin --format hex branch (lines 3401–3423): for each input file it builds an IntelHex from the image bytes at the given flash address (ihex.frombytes(image, addr)), merges them (out.merge(ihex)) and calls out.write_hex_file(output); it warns (lines 3404–3409) that with one input file the output “may include additional padding”. It never reads a HEX file, so the reading rules are those of the python-intelhex row above (the library does the reading and writing); in cmds.py the name IntelHex occurs only on line 18 (the import) and in that branch. The vendor programmers (MPLAB IPE, PICkit, STM32CubeProgrammer, Keil, IAR) have no public source; for them nothing is claimed.
What objcopy writes
| Item | GNU objcopy (ihex_write_object_contents) | llvm-objcopy (IHexSectionWriterBase::writeSection, IHexWriter) |
|---|---|---|
| Data per record | 16 bytes at most (#define CHUNK 16), never across a 64 KiB boundary | 16 bytes at most (ChunkSize = 16), never across a 64 KiB boundary |
| Line ending, digits | CR LF, upper case | CR LF, upper case |
| When a new base is needed | When the address is below the linear base, or below linear base plus segment base, or more than 0xFFFF above their sum (ihex.c 805-807). No base record is written before the first data if the address is already 0000 to FFFF: both bases start at 0. | When Addr > SegmentAddr + BaseAddr + 0xFFFF (writeSection, line 358). There is no test for an address below the current base, because the sections are sorted by physical address first (ASCIIHexWriter::finalize, line 2800). |
| Which base record | A type 02 record if no linear base is in force (extbase == 0) and the address is at most 0xFFFFF (below 1 MiB): the segment base written is the address with its low 16 bits cleared (where & 0xf0000), so a segment base never holds more than the top four bits of the 20-bit address. Otherwise a type 04 record with where & 0xffff0000; if a segment base is in force, a type 02 record with value 0 is written first and the segment base is reset (lines 805-852). Because of the extbase == 0 test, once a type 04 record with a non-zero upper half has been written, later addresses below 1 MiB (a section out of order) get a type 04 record too, never a type 02. | Type 02 if the address is at most 0xFFFFF, type 04 above that (lines 359-368). The llvm test is on the address only: it does not ask whether a linear base is in force, which is the difference from the GNU condition. If a segment base is in force when a type 04 is needed, a type 02 record with value 0 is written first (lines 362-363). Same segment-base value as GNU: Addr & 0xF0000. |
| Address range | The 64-bit build refuses an address that does not fit 32 bits: the error is “64-bit address 0x… out of range for Intel Hex file” (ihex.c 779-789) when where > 0xffffffff and where + 0x80000000 > 0xffffffff, so a 32-bit address sign-extended to 64 bits (such as 0xFFFFFFFF80000000) is accepted and masked to 32 bits (line 790). A second check, “address 0x… out of range for Intel Hex file” (lines 838-847), asks whether the address is above the linear base just written plus 0xFFFF. It does fire when a section crosses 0xFFFFFFFF, because the masking at line 790 is done once, before the loop, and where += now (line 864) is not masked. What GNU objcopy 2.47 and llvm-objcopy 22.1.8 do on the same command lines (a section that crosses 0xFFFFFFFF, one that ends exactly at it, one above 32 bits, and start addresses above 32 bits) is in the table below. In the segment form there is no 1 MiB error: an address above 0xFFFFF simply makes the writer switch to type 04 records, as the row above says. | The address is masked to 32 bits without an error (sectionPhysicalAddr(Sec) & 0xFFFFFFFFU, line 355). The refusal is made earlier, by ASCIIHexWriter::finalize and checkSection (lines 2775-2790): “section '…' address range [0x…, 0x…] is not 32 bit” if the first or the last address of a section overflows 32 bits (the same sign-extension allowance, addressOverflows32bit, line 193), and “entry point address 0x… overflows 32 bits”. That IHexWriter derives from ASCIIHexWriter (so that these 32-bit checks apply to the Intel HEX writer) is declared in ELFObject.h (class IHexWriter : public ASCIIHexWriter, lines 395-399; ASCIIHexWriter itself, with finalize and checkSection, lines 379-393); we saved that file and read it. A section that crosses 0xFFFFFFFF is refused earlier than GNU does, one that ends at 0xFFFFFFFF is written, and a start address above 32 bits is refused where GNU writes it truncated: see the table below. |
| Start address | Not written when 0. Type 03 if at most 0xFFFFF: the four bytes are N0 00 hh ll, where N is bits 16-19 of the address (so CS = N000, which with the offset hhll is the address) and hhll is bits 0-15; otherwise type 05 with the 32-bit value (lines 870-895). The start address is not range-checked: a value above 32 bits goes into type 05 truncated to its low 32 bits. | Not written when 0 (writeEntryPointRecord, lines 2823-2842). Type 03 if at most 0xFFFFF, in the same byte layout, otherwise type 05. A start address that overflows 32 bits is refused by finalize (above). |
| End | Always :00000001FF | Always :00000001FF |
The same command lines on both tools
Run on 19 November 2026 by scripts/hex/objcopy-4g-cross.mjs in the project notes (GNU objcopy 2.47, llvm-objcopy 22.1.8): 32 bytes of
A5 as the binary input in32.bin, -I binary -O ihex, one section .data. The tools do not have the same
options, so each row names the exact option set of each tool. Three sets were used:
- A:
--change-section-address .data=Xon both tools. Only the section moves. - B:
--change-section-address .data=X --change-start Xon both tools. The section and the start address move by the same amount. - C:
--change-addresses X, GNU objcopy only (llvm-objcopy has no option of that name). In GNU objcopy it does what B does: the option setschange_section_addressand alsochange_startto the same value (objcopy.clines 5744-5745), and the start address written is the input’s start pluschange_start(line 2817). The output of C was equal to that of B in every row.
| Section address X | Option set | GNU objcopy 2.47 | llvm-objcopy 22.1.8 |
|---|---|---|---|
0xFFFFFFE0 (ends at 0xFFFFFFFF) | A | Written: :02000004FFFFFC, :10FFE000A5…C1, :10FFF000A5…B1, :00000001FF. No start record. | The same output. No start record. |
0xFFFFFFE0 | B (GNU: also C) | The same three records, then the start record :04000005FFFFFFE01A, then the end record. | The same output as GNU: the start record :04000005FFFFFFE01A. |
0xFFFFFFF0 (crosses 0xFFFFFFFF) | A, B (GNU: also C) | Exit 1: “address 0x100000000 out of range for Intel Hex file”. | Exit 1: “section ‘.data’ address range [0xfffffff0, 0x10000000f] is not 32 bit”. |
0xFFFFFFF8 | A, B (GNU: also C) | Exit 1: “address 0x100000000 out of range for Intel Hex file”. | Exit 1: “section ‘.data’ address range [0xfffffff8, 0x100000017] is not 32 bit”. |
0x100000000 (above 32 bits) | A | Exit 1: “64-bit address 0x100000000 out of range for Intel Hex file” (the first check). | Exit 1: “section ‘.data’ address range [0x100000000, 0x10000001f] is not 32 bit”. |
0x100000000 | B (GNU: also C) | Exit 1: the same “64-bit address 0x100000000 out of range” message. | Exit 1: “entry point address 0x100000000 overflows 32 bits” (the start address is checked first: ASCIIHexWriter::finalize, line 2787). |
Start 0x123456789 (--set-start, the section stays where it is) | --set-start | Written, truncated to 32 bits: :0400000523456789. | Exit 1: “entry point address 0x123456789 overflows 32 bits”. |
Start 0xFFFFFFFF80000000 (sign-extended) | --set-start | Written: :040000058000000077. | Written: :040000058000000077. |
Why a start record appears. The input is a binary file, whose start address is 0, and a writer does not write a start record for 0 (GNU:
ihex.c 870-895; llvm: writeEntryPointRecord, lines 2823-2842). With set A the start stays 0, so there is none. With set B or C the start
address is moved by X as well, so it is X and both tools write :04000005FFFFFFE01A. It is not something GNU adds on its own: an earlier version of this page
attributed the record to GNU alone, but that was a result of comparing different option sets (--change-addresses on GNU, which moves the start too, against
--change-section-address on llvm, which does not).
Types other vendors use
Wikipedia (secondary source; we have not seen the vendors’ own documents) lists these. They are not Intel’s: the explorer names them in the problem it reports and does not load them as data.
| Type | Used by | Meaning |
|---|---|---|
06 | Wayne and Layne | “Blinky” messages: a transmission protocol container. |
0A–0E | BBC / Micro:bit Educational Foundation (Universal Hex Format) | 0A block start, 0B block end, 0C padded data, 0D custom data, 0E other data. |
81–84 | Digital Research (CP/M-86) | Data in the code, data, stack and extra segment. |
85–88 | Digital Research | Paragraph address for the absolute code, data, stack and extra segment. |
Wikipedia also names Microchip’s variants for its PIC microcontrollers: INHX8M (and INHX8S, INHX8L, INHX8H), INHX16 (INHX16M) and INHX32. (Its wikitext spells the split variant “INTHX8S”, and its page anchors say INHX08S; the 1994 Microchip Databook chapter it cites is titled “8-Bit Split Intellec Hex Format (INHX8S)”, so INHX8S is the name used here. INHX8L and INHX8H are cited to the AS manual.) INHX8M and INHX32, the two that PIC firmware files come in, are described in the next section. The others are not described here (see “Not described” on the overview), nor are the other variants Wikipedia names: Mostek, TDL, Zilog, Texas Instruments (addresses counted in the processor’s register width), c’t, and start codes other than the colon.
Microchip INHX8M and INHX32
PIC microcontrollers address program memory in words of 12, 14 or 16 bits, while Intel HEX is byte-oriented. Microchip’s answer is Intel HEX with two changes: each data word is two bytes, low byte first, and every address in the file is twice the word address. This section follows two pages by Brian Beard of Lucid Technologies, a third-party site that Wikipedia cites for these formats (read from the Internet Archive copies of 28 February 2020; the pages themselves say they were last updated in October 2011), and checks them against Microchip’s own manual and the manual of the AS assembler.
INHX8M
Lucid describes it as Microchip’s adaptation of Intel’s 8-bit form. The record is Intel’s (colon, byte count, address, type, data, checksum), with these differences:
| Field | In INHX8M (Lucid’s wording, in ours) |
|---|---|
| Byte count | The number of bytes in the data field; the number of data words is half of it. |
| Address | Two times the 16-bit address of the first data word. The bytes at 0200 and 0201 are the PIC word at 0100. As this is a 16-bit field, it reaches only the 32 k words that fit in 64 KiB of bytes; larger devices use INHX32. |
| Type | Only 00 (data), 01 (end of file) and 04 (extended linear address, used by INHX32). Lucid says the one end-of-file record is allowed per file and must be the last line. |
| Data | Words of two bytes, low byte then high byte, four characters per word. |
| Checksum | The least significant byte of the two’s complement of the sum of every byte of the record except the start code and the checksum: Intel’s rule. |
| Line end | Lucid says a record may be ended by CR, LF or NUL. |
:100042006801A9018901EA01280208026A02BF02C5
:00000001FF
0042, that is PIC word address 0021, where the word is 0168 (the bytes 68 01).We recomputed the checksum: 10 + 00 + 42 + 00 = 0x52, the sixteen data bytes add up to 0x3E9, the total 0x43B has low byte 3B, and 0x100 − 0x3B = C5, as in the example.
INHX32
Lucid: the format Microchip uses for processors whose memory is mapped at 8000h (32 k) and higher, in most respects
identical to INHX8M. The difference is the type 04 record, which extends the address from 16 to 32 bits:
its byte count is 02, its address field 0000, and its two data bytes are the upper 16 bits of the
address of every type 00 record after it, until the next type 04 record. If the file does not start
with a type 04 record, the upper 16 bits are 0000. That is the same record as Intel’s extended linear
address record (type 04), so INHX32 is Intel HEX with types 00, 01 and
04, plus the word rules above.
:020000040001F9
:02000E00E4C943
0001, then one word at 000E. The file address is 0001000E; halved, the PIC word address is 8007, and the word is C9E4 (bytes E4 C9).Checksums recomputed: 02 + 04 + 01 = 0x07, so F9; 02 + 00 + 0E + 00 + E4 + C9 = 0x1BD, low byte BD, so 43.
What Microchip’s own manual says
We read the MPLAB XC16 Assembler, Linker and Utilities User’s Guide (DS50002106D, 277 pages) as extracted text and, for the page
quoted here, as the rendered page. Section 15.3 (xc16-bin2hex, page 240) calls its output “Intel hex files”. It says that, because Intel hex is
byte-oriented and the 16-bit program counter is not, each program memory address is multiplied by 2 to give a byte address, that data are
“little-endian” (least significant byte first), and that each 24-bit program word is extended to 32 bits by a “phantom byte” that comes last,
before the checksum. Its example puts a section at program address 0x100 at load address 0200 and starts the
file with :020000040000fa, an extended linear address record. The manual does not use the names INHX8M or INHX32
(no occurrence in its text), and it does not say which of Microchip’s tools write which form, so we cannot say from Microchip’s documents that INHX32 is
the default output of MPLAB. This is the 16-bit family (dsPIC, PIC24: 24-bit words, four bytes each), not the 12-, 14- and
16-bit-word PICs of INHX8M, but the doubled address and the low-byte-first order are the same.
One detail of that example, by our arithmetic: the data line :040200003322110096 shows checksum 96, but its
bytes 04 02 00 00 33 22 11 00 add up to 0x6C, whose two’s complement is 94. The rendered page has the same digits as the
extracted text, so this is in Microchip’s document, not in our extraction. The explorer, which checks every checksum, reports it.
INHX8S, INHX16 and the rest: what Microchip’s documents say
Two Microchip documents describe them (read 19 November 2026; single files saved in our samples/hex/sources folder).
INHX8M, INHX8S and INHX32 in the MPASM User’s Guide (DS33014F, 1997, Appendix A “Hex File Formats”, pages 101–103; a PDF kept by the University of Washington, text extracted with our script and read). It lists three formats: Intel Hex Format (INHX8M) “for standard programmers”, Intel Split Hex Format (INHX8S) “for ODD/EVEN ROM programmers” and Intel Hex 32 Format (INHX32) “for 16-bit core programmers”. In our words: INHX8M gives one 8-bit file in which every address is doubled and the data are low byte, high byte pairs; its record type is 00 except the end-of-file record 01; the checksum is the two’s complement of the sum of the preceding bytes. INHX8S is the same format split into two files, .HXL with the low bytes of the data words and .HXH with the high bytes, “and the addresses are divided by two”: it is used to program 16-bit words into pairs of 8-bit EPROMs, one file for the low byte and one for the high byte. (So the names INHX8L and INHX8H, which Wikipedia and the AS manual use, are the two halves of INHX8S, as that guide’s file extensions say; the guide itself does not use the names.) INHX32 adds the extended linear address record; the guide’s list of record types for it is 00 data, 01 end of file, 02 “Segment address record” and 04 “Linear address record”, so this guide lists type 02 where Lucid Technologies and the later Microchip documents list 04 and 05; we cannot tell from the documents whether the 02 is a slip (the explorer reports a 02 in the PIC reading as “not an INHX type”). Its examples are an INHX8M file (:1000000000000000000000000000000000000000F0 and so on, ending in :00000001FF) and a split pair that starts :0A00000000…F6 in both files. The guide is from 1997 and describes MPASM of that time.
INHX8M, INHX16 and INHX32 in the MPLAB XC8 C Compiler User’s Guide (section “HEX File Formats”, Hexmate; the page onlinedocs.microchip.com saved as one HTML file; its table was read through a summarising fetch tool and the text around it with grep on the saved file, so the table is “our words”). A HEX file with only type 0 and 1 records “is often said to conform to the Microchip INHX8M format”; one that also has type 4 (and 5) records is INHX32; Hexmate “can also read HEX files that are said to conform to the Microchip INHX16 format, although this format is less commonly used”, which has type 0 and 1 records and type 2 extended segment address records, whose base is the type 2 value shifted left 4 bits, like a type 4’s base. The table gives the valid record types and the address range: INHX8M 0, 1 (16 bit); INHX16 0, 1, 2, 3 (20 bit); INHX32 0, 1, 4, 5 (32 bit). Microchip adds that type 2 records are not used by its debugging tools, though GCC-based MPLAB XC compilers may produce them. So INHX16, as Microchip describes it, is Intel’s 16-bit (segment) form with types 00, 01, 02 and 03: the explorer’s reading without “PIC words” (types 02 and 03 accepted) is that reading.
The manual of the AS assembler (section 6.3, P2HEX; a third-party tool) names the same family: its option -m selects
INHX8M (all bytes low-high, addresses doubled because PIC address space counts words; the default of P2HEX), INHX16M (bytes in natural
order, “the format Microchip uses for its own programming devices”) and INHX8L and INHX8H (the low and the high bytes of each word in two
separate files). The INHX8M and INHX8L/INHX8H descriptions agree with the MPASM guide above (INHX8S is the pair). INHX16M (bytes in natural order, which would make the file a plain Intel HEX with word data) is described only by AS and Wikipedia: Microchip’s XC8 text names INHX16 and gives its record types and no byte order for the data, so “INHX16M: natural byte order” and “INHX16: segment records” are two descriptions that we could not join until 26 November 2026: see “INHX16 in Microchip’s Hexmate guide” below.
Mostek and TDL are now described from their own documents (next section); no primary document was found for the Texas Instruments variant with addresses counted in register widths, for Zilog or for c’t (search record in the next section).
Mostek and TDL: the 1977 documents
Wikipedia cites two 1977 issues of BYTE magazine for these variants. Their full OCR text was fetched from the Internet Archive on 25 November 2026 and kept in samples/hex/sources (byte-1977-07.txt, byte-1977-11.txt); the passages below are in those files at the text lines given. The text is OCR, so a digit may be misread; the byte tables were read as printed.
Mostek (Peter G. Formaniak and David Leitch, “A Proposed Microprocessor Software Standard”, BYTE, July 1977, pages 34 and 61–62; text lines 5320–5430 and 10340–10470). The text “was provided by Mostek to document one interchange standard intended for the Mostek version of the Z-80” and “is intended to be an upwards compatible extension of the original Intel 8080 object code format, with provision for relocatable programs and linkage of separate assemblies”. Each record starts with a delimiter, a colon or a dollar sign, and ends with carriage return and line feed. “A colon (:) is used for data records and end of file indicator for Intel compatibility. A dollar sign ($) is used for records containing relocation information and linking information. An Intel loader will ignore such information.” The record type is in the eighth and ninth bytes of the record (the paper counts the delimiter as byte 1, so these are the two digits after the four-digit address) and takes five values: 00 data (count, address high and low, type, data, checksum; at most 32 binary bytes), 01 end of file (colon, count 00, the transfer address of the program’s END statement, type 01; the paper’s byte table lists no checksum for it), 02 internal symbol (dollar sign, up to six ASCII characters of the name, left-justified and blank-filled, type 02, the four-digit address, checksum), 03 external symbol (the same fields; the address is the last place that uses the symbol, the start of a backward linked list that ends at FFFF) and 04 relocating record (dollar sign, the number of two-character sets, zeros, type 04, up to 16 addresses that must be relocated, checksum). The checksum is “the negative of the binary sum of all bytes in the record” except the delimiter, carriage return and line feed. The assembler writes internal symbols, then external symbols, then data records interspersed with relocation records, then the end of file record. This is a different record set from Intel’s (its 02 to 04 are not Intel’s 02 to 04, and 05 does not exist), and the paper says an Intel loader ignores the dollar-sign records.
TDL (Technical Design Labs, “Relocatable Object Module Format”, text by Neil Colvin, given out at the National Computer Conference in June 1977 and printed in BYTE, November 1977, page 202 ff.; text lines 58590–58770). The records start with CR LF and a semicolon (;) prompt; then the number of binary data bytes (at most 32; zero means end of file), the load address relative to the relocation base, the relocation base for the record, a relocation control byte (its bits, from the left, say for each of the next eight data items whether it is one absolute byte (bit 0), a two-byte relocatable value (10) or a three-byte reference to a different relocation base (110)), the data bytes and a checksum. The end of file record is ; with count 00, the starting address of the module, its relocation base and the checksum. This is a relocatable object format, not Intel HEX. A second description of the format as one user applied it (Nascom Journal, June 1981, page 12; nascom-journal-1981-06-p12.html, in German) agrees: line start CR LF and a semicolon, count, load address, 01 “relocatable format”, a relocation byte, eight data bytes (the author’s modification; standard TDL has a variable number) and a checksum that is the two’s complement of the sum of all bytes except CR LF and the semicolon.
Other documents read (25 November 2026): Texas Instruments’ SPRU513 section 12.15.5 describes “TI-Tagged” (tag characters K, 7, 8, 9, B, F and *, a colon ends the file): a different format, not an Intel HEX variant and not the “register width” one. Microchip’s “Appendix B: HEX File Format” of a programming specification (refers to DS33014 and repeats the INHX32 example with the checksum 96) and the Hexmate “Intel HEX file Specification” page were read and agree with the text above; the XC8 Hexmate “format” option page lists INHX8M (types 0, 1; 16-bit addresses), INHX16 (types 0 to 3; 20-bit), INHX32 and INHX032 (types 0, 1, 4, 5; 32-bit; INHX032 is not an actual named INHX format and also writes a type 4 record with base zero), read through a summarising fetch tool. Added 27 November 2026 (hex13): Zilog’s application notes AN0328 (Z8 Encore! XP bootloader, Intel Hex32 with types 00, 01 and 04) and AN0373 (“The hexadecimal file generated by ZDS II is an Intel Hex file”, types 00 to 05; saved Wayback copies, samples/hex/sources/zilog/) agree with UM0130: Zilog’s format is plain Intel Hex, nothing Zilog-specific. For Texas Instruments, a TI answer in the E2E forum (thread 1118569) says the byte counts in the file against word addresses follow the memory-width setting of the hex converter (C28x assembly tools manual, section 12.3.2): the address field counts target words unless --byte is given; no manual states what the count field counts at a 16-bit width, and there is no TI sample file here. Still without a primary document: the Texas Instruments variant Wikipedia names (addresses in register widths; its wikitext gives no reference for the sentence, and the TI documents found, TI-Tagged and TI-TXT, are other formats), Zilog (no Zilog hex document was found; the search found only assembler manuals), c’t (the 1987 article Wikipedia cites is not online) and the name INHX16M (the AS manual only; for INHX16 see the Hexmate guide below, which gives no byte swap). The MPASM guide’s type 02 for INHX32 is a difference between documents, described above; no document explains it. Searched again on 27 November 2026 (web searches for “INHX16M”, for c’t, and for a Zilog hex format): “INHX16M” is found only in the p2hex man page (the AS tool, option -m 1) and in Wikipedia copies; the c’t article is found only as Wikipedia’s citation (Jörg Zschocke, “Nicht nur Entwicklungshilfe”, c’t 11/1987, Intel-Hex format for downloading to single-board computers); and the Zilog-style assemblers found (Dynabyte ZASM, SLR Z80ASM, 1984) write plain Intel standard hex. That search found no layout; the later search of 27 November 2026 (hex12), through tool source code and old magazine reprints, is described in the next section.
The variant names, checked in tool source code and reprints (27 November 2026, hex12)
Sources saved under samples/hex (addresses and SHA-256 in samples/README.md); the test parser-test/test-hex-vendor-oracles.mjs checks every quoted passage and runs the files made by the real tools through the viewer. Where a claim rests on a reprint or on a summary rather than on the document itself, it says so.
c’t (11/1987, Zschocke, “Nicht nur Entwicklungshilfe”). The article is not online, but the German Club-80 magazine (Club-80 INFO 37, October 1992, page 21, vendors/club80-heft37.pdf) reprints its Intel-Hex box, and says it was copied from c’t (“aus der Zeitschrift c’t auskopiert”); this is the same text that Wikipedia quotes, so what follows rests on a reprint, not on the c’t issue. The layout is the plain Intel record: colon, byte count, 16-bit address, type byte, data, and a checksum that is the negative of the sum of all other bytes. The one variation is the end: types are 0 = data block and 1 = end block, “but the distinction can be dropped if an end block can also be recognised by a block length of zero (most CP/M assemblers do this, XASM09 too; the type byte is then always zero)”. So the c’t variant is :0000000000 as the closing record, and the same line is what Macro Assembler AS writes with p2hex -i 2 (below); page 20 of the same issue shows the output of a TRS-80 program ending in : 0000000000 (the scan is not clean). The explorer reads it as a zero-length data record at the end and notes it once. There is no register content, start code or other extension in the c’t text.
Texas Instruments (addresses counted in target words). Wikipedia’s sentence has no reference. The closest TI document is the hex conversion utility of the C2000 tools (SPRU513O, “Controlling the ROM device address”, vendors/ti-c28x-hex-utility.html): “Some EPROM programmers may require the output file address field to contain a byte count rather than a word count. If you use the −byte option, the output file address increments once for each byte. For example, if the starting address is 0h, the first line contains eight words, and you use no −byte option, the second line would start at address 8 (8h)… If … you use the −byte option, the second line would start at address 16 (010h). The data in both examples are the same”. So, without --byte, TI’s Intel output counts the address field in target words (16-bit words on a C2000), with --byte in bytes; the record types are 00, 01 and 04 (SPNU118 12.15.2). Whether this is what Wikipedia means is an inference (the page says “register widths”; TI says “word count”). What TI does not state in its pages (SPRU513O 12.13.2 says only “byte count”): whether the length field of such a record counts words or bytes. Settled from real files (27 November 2026, hex14). Two files written by hex2000 at memory width 16 (--memwidth=16 --romwidth=16 --intel) were pasted by users in python-intelhex issue 34 (saved with SHA-256 in samples/README.md, samples/hex/ti/). In the first, :02000004003FBB is followed by :20213200835E3F6C… and :20214200… and :0C215200…: each 0x20-byte record holds 16 words and the next record’s address is 16 higher (0x2132, 0x2142), the last record has 0x0C bytes = 6 words; the poster states that the words at 0x3F2132, 0x3F2142 and 0x3F2152 are 0x835E, 0x0000 and 0xAAAB. In the second, :020000040032C8, :048000000072B05802, :20800202…, :20801200…: the first record has 4 bytes = 2 words, the next address is 0x8002, then 0x8012; the poster also pasted the CCS memory dump of the flashed device, memrd 328000 = 0072 B058 761F 0006 …, so the type 04 value (0x0032) is the upper 16 bits of the word address, and each word is written high byte first. So: byte count = number of data bytes (two per word), address = word address, word = high byte first, type 04 = upper 16 bits of the word address (written high byte first, as in plain Intel HEX). A second, independent reader agrees: bincopy’s add_ihex with word_size_bits=16 (saved) takes the count as data bytes and multiplies the record address plus the type 04 value by the word size; it reads both files to the stated words (parser-test test-hex-c28x.mjs, 103 checks, also compared with the CCS memory dump). The TI tool itself was not run (no macOS-runnable copy was extracted) and TI’s own host tool sources were not found; the two files come from real hex2000 runs, not from a TI document. The explorer reads this layout through the option Addresses and words: TI C28x words; in the default option the addresses are read as byte addresses, so the memory image is placed at half the byte address and its words are not marked. The same count in bytes differs from gputils/SRecord INHX16, where the count is in words.
Zilog. The Zilog Developer Studio II user manual for the Z8 Encore! (UM013037-1212, saved from the Wayback Machine; zilog.com answers curl with “Access Denied”, not worked around) lists the linker outputs as IEEE 695 (.lod) and “Intel Hex32 (.hex), which is a backward-compatible superset of the Intel Hex16 format”, with two options: fill unused bytes with 0xFF and a maximum number of bytes per line. So ZDS II writes Intel HEX; the manual describes no Zilog-specific start code, record type or checksum. The Z80 assemblers found earlier (Dynabyte ZASM, SLR Z80ASM) also write standard Intel hex. No Zilog document of a different layout was found; the “Zilog” of Wikipedia’s list is, as far as any source found shows, plain Intel HEX (an absence of evidence, not a proof; Zilog application notes AN0328 and AN0373 about HEX loaders were not read because zilog.com refused the download).
Macro Assembler AS, p2hex.c (source saved: sources/as-p2hex.c, version 1.42 Bld 306, built here and run). Options: -m 0..3 (“MultiMode: 0=8M, 1=16, 2=8L, 3=8H”) and -i 0..2. For a PIC (two bytes per word) the data go out in the order of the AS code file (low byte first) and the address is the byte address (word address doubled). Measured: -m 0 and -m 1 write the same file (samples/hex/as-p2hex/m0.hex = m1.hex): the byte swap that the manual’s “INHX16M: natural order” asks for is written in the source as if ((MultiMode == 1) && (record_gran_bits(Gran) <= 8)), and a PIC word has 16 bits, so it is not taken; the manual and the program differ. -m 2 and -m 3 (INHX8L, INHX8H) write the low and the high bytes of the words, one byte per word, with the word address in the address field. The end-of-file record has three forms (-i): :00aaaa01cc (with the start address and checksum, :00000001FF when there is none), :00000001 (no checksum, nine characters) and :0000000000. With a start address AS writes type 05 (INHX32), 03 (the 16-bit segmented format) or none, and type 02 and 04 records for the segment and bank. Types 02 and 04 are written by the format chosen for the CPU, not by a type 02 in INHX32.
gputils 1.5.0 (gpasm, libgputils/gpwritehex.c and gpreadhex.c, saved). INHX8M, INHX32 and the split INHX8S (.hxl and .hxh) agree with the Microchip documents and with AS: the INHX32 file is a type 04 record for each 64 K-word bank written (:020000040000FA first, also for bank 0) followed by the INHX8M lines, then :00000001FF; there is no type 02 in INHX32. Measured difference: for the same program the second record of the INHX8S low file has address 0010 in gpasm (the byte address, not halved) and 0008 in AS’s INHX8L (the MPASM guide says halved). gputils’ INHX16 is another layout from the Hexmate one: the byte count and the address are in words, and the two bytes of every word are written high byte first (the writer’s comment: “inhx16 line length is in words that are big endian (not in MPLAB IDE 8.40)”; the writer asserts even start and stop, and a comment says MPLINK does not support it and that the source of the format is unknown). The reader (gpreadhex.c) first reads a file as INHX8M, and when a checksum fails starts again as INHX16 (address *= 2; length *= 2, the bytes of a word swapped). Example from gpasm (samples/hex/gputils/t16-inhx16.hex): :03000000301200852834DA = three words 3012, 0085, 2834 at word address 0; the INHX8M file of the same program has :06000000123085003428D7. The checksum is over the record as written (count in words, 2 × count data bytes). SRecord’s “Intel HEX 16” (measured above) has the same shape. So there are three things called INHX16 or INHX16M, each with a source: Microchip’s Hexmate (types 0 to 3, bytes in order), AS p2hex (written like INHX8M in the build tested, while its manual says natural order) and gputils/SRecord (words, big-endian). The explorer reads the first (type 02 and 03 records are understood); it reads the gputils/SRecord form only when you choose the option Addresses and words: PIC words, word-addressed (added 27 November 2026, hex13): the count is taken as words, the address as a word address, each word is swapped back, and the image is the same as that of an INHX8M file of the same program. The option was checked against two oracles: gpasm 1.5.0 (-a inhx16 against -a inhx8m of the same source, samples/hex/gputils/t16w-*.hex) and SRecord 1.65, whose own Intel_16 reader gives the same bytes (samples/hex/srecord16/*.dump; parser-test/test-hex-words16.mjs, 34 checks). In this layout a type 04 record holds the value low byte first and counts 128 K bytes (SRecord, intel16.cc: value << 17; type 02: value << 5). In the default reading such a file still shows wrong checksums (the count is taken as bytes), which is correct for an Intel HEX reader.
The viewer after this stage. AS’s :00000001 (end of file without a checksum) used to be shown as a record that is too short; it is now read as an end-of-file record, with one problem (“an end-of-file record without a checksum”). Nothing else of the reading changed. Not supported: the gputils/SRecord word-addressed INHX16 and a TI word-addressed file (no sample from a TI tool, count semantics not documented).
INHX16 in Microchip’s Hexmate guide (Hexmate User Guide, DS-50003033D, 2024, section 2.2 “HEX file formats”, pages 10 and 11; the PDF and its text are saved). Hexmate “can also read HEX files that are said to conform to the Microchip INHX16 format, although this format is less commonly used. In addition to the type 0 and 1 records, these file formats can also contain type 2 Extended Segment Address Records … the base address is calculated as the Argument payload of the type 2 record shifted left 4 bits.” Its Table 2-2: INHX8M, record types 0 and 1, 16-bit address range; INHX16, types 0, 1, 2, 3, 20-bit; INHX32, types 0, 1, 4, 5, 32-bit. “Any type 4 record will be converted to a type 2 record if possible when producing an INHX16 format; otherwise, an error will be produced”, and a type 2 record becomes a type 4 for INHX32. Its worked example (:0240F0001200BC, :020000021000EC, :04FFFC005BEF20F0A7) takes the bytes of a data record in the order written (the first byte, 12, has the lower address): Hexmate treats the data of INHX16 as plain bytes. So Microchip’s own text defines INHX16 by its record types and its 20-bit range, and gives no byte swap; this agrees with the AS manual’s “INHX16M: bytes in natural order” and with the name INHX16 being Intel HEX with segment records (which is also what the explorer reads). The name “INHX16M” and the sentence that it is what Microchip’s programming devices use are in the AS manual only; no Microchip document spells “INHX16M”. What is not settled by a Microchip document: whether an old (1990s) Microchip programmer wrote or expected words in another order for INHX16; the MPASM guide of 1997 does not list INHX16 at all.
Measured with SRecord 1.65 (26 November 2026; its “Intel HEX 16”, which is SRecord’s own name and is not shown to be Microchip’s INHX16 or INHX16M): given the four bytes 11 22 33 44, srec_cat -o - -Intel_HeXadecimal_16 writes :010000040000FB, :020000002211443354, :00000001FF: a count of words, word addresses, each word written with the second byte first (2211) and a type 04 record with a count of 1; the 8-bit writer writes :020000040000FA, :040000001122334452. This does not settle INHX16M’s byte order for Microchip tools.
In the explorer. A HEX file does not say whether it is Intel HEX or one of these, so the options bar has an
“Addresses and words” choice: with PIC words the memory image is shown as words (high byte first, as the PIC reads them), at word
addresses (half the file address), and records of types 02, 03 and 05, odd byte counts and odd
addresses are reported as not fitting INHX8M or INHX32. It says INHX32 when the file has a type 04 record and INHX8M when it has none.
No PIC processor is disassembled.
Sources
- Hexadecimal Object File Format Specification, Revision A – Intel, 6 January 1988 (11-page PDF: a copy kept by Cornell University’s ECE 4760 course; the file’s own date is October 1998). This page follows it for the record mark, the field layout and sizes, the order of the digits in a byte, the six record types and which of the three forms allows each, the maximum
RECLENofFF, the rule that unused load offsets are coded0000, the checksum rule, both address formulas and their wrap-around, the rule that base and start records may appear anywhere and the start records are optional, and the fixed end-of-file record:00000001FF. It was first read as page images and then, on 14 November 2026, as extracted text (all 11 pages, each rule on this page checked against the text); on 19 November 2026 pages 1, 5, 6, 7, 10 and 11 (the title page, the general record format, the extended linear and segment address records, the start segment address record and the end-of-file record) were also rendered and compared with the extraction, which agrees with them (the extraction and the print both write the wrap-around addresses with the letter O for the digit zero, a typographic slip of the document); where this page says “our words” it is a reading of that text, not a quotation. It does not say that the end-of-file record must be last or appear once, that digits are upper case, how records are separated, what to do with an unknown record type, or anything about the names I8HEX, I16HEX, I32HEX, HEX-80, HEX-86 and HEX-386; those points are marked convention and rest on the other sources below. - srec_intel(5) – the SRecord package’s description of the format, which quotes Intel’s address formulas (
MOD 64K,MOD 4G); a secondary source, re-read in full for this revision (including the note that the end-of-file record’s load offset was once the start address; itssrec_cat(1)page uses i8hex, i16hex and i32hex only as address lengths) - Intel HEX – Wikipedia: record fields, the six types, the three forms and their names, the checksum example, history, the NUL leader, line terminators, the CP/M zero-length record, and the vendor types and variants; a secondary source, re-read from its wikitext for this revision and again on 19 November 2026 (the one difference found: its spelling “INTHX8S”, see the vendor section)
- bfd/ihex.c – GNU binutils, the reader and writer behind
objcopy: source code, read in full; the basis of “how real readers behave” - llvm/lib/ObjCopy/ELF/ELFObject.cpp – LLVM (Apache-2.0 with LLVM exception), the Intel HEX reader and writer of
llvm-objcopy(IHexRecord,IHexReader,IHexELFBuilder,IHexWriter): source code, themainbranch of 19 November 2026, read for the llvm-objcopy rows of “how real readers behave” and “what objcopy writes”. Fetched again on 19 November 2026 (byte for byte the same as the first copy), together with its header ELFObject.h, which declaresASCIIHexWriterandIHexWriter(see “what objcopy writes”) - intel.cc, intel.h and input/file.cc – SRecord’s Intel HEX reader, its header (the starting mode) and the base class that reads characters (CR LF to LF), source code, read for the same section
- Microchip INHX8M HEX-record Format and Microchip INHX32 HEX-record Format – Brian Beard, Lucid Technologies; third-party pages (cited by Wikipedia), read from the Internet Archive copies of 28 February 2020; the basis of the Microchip section; the saved copies were re-read line by line against this page on 19 November 2026 (field table, types, line ends, both examples and the 0x8007 word address agree)
- MPLAB XC16 Assembler, Linker and Utilities User’s Guide (DS50002106D), section 15.3, pages 240–241 – Microchip; read as extracted text and as the rendered page 240; the text of section 15.3.3 was re-read against this page on 19 November 2026 (the doubled address, little-endian order, phantom byte and the example lines agree)
- Macro Assembler AS – User’s Manual, section 6.3 (P2HEX) – Alfred Arnold; a third-party tool’s description of INHX8M, INHX16M, INHX8L and INHX8H
- MPASM User’s Guide with MPLINK and MPLIB (DS33014F, 1997), Appendix A, pages 101–103 – Microchip; the primary description of INHX8M, INHX8S (the .HXL and .HXH files) and INHX32, read as extracted text (a copy kept by the University of Washington)
- BYTE, July 1977 (Mostek, pp. 34, 61–62) and BYTE, November 1977 (TDL, p. 202 ff.), Internet Archive OCR text, and the Nascom Journal, June 1981 – the Mostek and TDL formats; read 25 November 2026 (see “Mostek and TDL: the 1977 documents”)
- MPLAB XC8 C Compiler User’s Guide for PIC MCU, “HEX File Formats” – Microchip; INHX8M, INHX16 and INHX32 with the record types and address range of each
- The readers of “five more readers”, each a single raw file: avr8js demo/src/intelhex.ts, avrdude src/fileio.c, OpenOCD src/target/image.c, stm32flash parsers/hex.c and IntelHex intelhex/__init__.py; source code, read for the table
The checksums in the examples were worked out by hand for this page.