BIN to HEX / HEX to BIN
Convert microcontroller/EEPROM binary files to Hex dump & back to BIN — 100% private client-side processing.
Active Converter
BIN to HEX & HEX to BIN: Byte-Level Firmware Representation
Technical Anatomy of BIN and Hexadecimal Encoding
In digital electronics and firmware engineering, raw binary (.bin) stores exact 8-bit machine values directly on disk, while hexadecimal (.hex) expresses each byte as two base-16 nibbles (0–9, A–F). Because four bits map cleanly to one hex digit, a single byte like binary 10101100 becomes compact, unambiguous AC. Hex representation allows technicians to inspect, diff, copy-paste, and email firmware blocks over plain-text channels without corrupting non-printable control characters such as 0x00 (NUL) or 0x1A (EOF).
In hardware flashing workflows, you will encounter both flat hex dumps (16 bytes per line) and framed records like Intel HEX (IHEX) or Motorola S-Record (SREC). An Intel HEX line follows :LLAAAATT[DD...]CC, where LL is the byte count, AAAA is the 16-bit memory offset, TT is the record type (00 data, 01 end-of-file, 04 extended linear address), and CC is the modulo-256 two's-complement checksum.
Raw Binary Bytes vs. Formatted Hex Output
# Source Raw .BIN (16-byte AVR / SPI Flash Vector Table):
[Binary bytes: 0x0C, 0x94, 0x34, 0x00, 0x0C, 0x94, 0x3E, 0x00, ...]
# Converted Clean Hex Dump (.HEX):
0C 94 34 00 0C 94 3E 00 0C 94 3E 00 0C 94 3E 00
11 24 1F BE CF EF D8 E0 DE BF CD BF 0E 94 40 00
# Reverse Conversion (HEX → BIN):
Reconstructs exact 32-byte Uint8Array binary image ready for flashing.
Real-World Software & Hardware Ecosystem
Bidirectional BIN/HEX conversion is indispensable when working with AVRDUDE, STM32CubeProgrammer, MPLAB X IDE (Microchip PIC), Keil uVision, Arduino IDE, and hardware bench tools like the XGecu TL866II Plus / T48, CH341A, and ST-Link V2. Satellite receiver technicians (Starsat, Tiger, Echolink) and laptop motherboard repair shops routinely compare BIOS/EC chips (Winbond W25Q64, Macronix MX25L128) in hex editors such as HxD or 010 Editor before converting patched hex regions back into a flashable .bin image.
Troubleshooting & Edge Cases
- Endianness Confusion (Little-Endian vs. Big-Endian): Hex dumps display bytes in exact storage order. When reading 16-bit or 32-bit integers on ARM Cortex-M or x86 chips, remember that
34 12represents0x1234in little-endian memory. - Address Offsets & Padding Gaps: If you convert a sparse Intel HEX file with a jump from
0x08000000to0x08004000into a flat binary, unprogrammed flash regions should be padded with0xFF(erased NOR flash state) rather than0x00. - Checksum Mismatch on Hardware Flashers: If you manually edit a byte inside an Intel HEX line, you must recompute the trailing checksum byte or tools like STM32CubeProgrammer will reject the file. Converting to BIN, editing, and regenerating avoids manual checksum math.
Intel HEX (.HEX) Record Byte Anatomy
| Field | Example | Purpose in Microcontroller Flashers |
|---|---|---|
| Start Code | : | Marks the start of every Intel HEX ASCII record. |
| Byte Count (LL) | 10 | Hex count of payload data bytes on this line (0x10 = 16 bytes). |
| Address (AAAA) | 0100 | 16-bit big-endian memory offset where bytes are written. |
| Record Type (TT) | 00 / 01 / 04 | 00 = Data, 01 = End of File, 04 = Extended Linear Address (32-bit STM32). |
| Checksum (CC) | A7 | Two's complement of LSB of the sum of all preceding bytes on the line. |
Desktop Toolchain CLI Equivalents (GNU objcopy & xxd)
Embedded Linux and bare-metal ARM developers normally rely on GNU Binutils (arm-none-eabi-objcopy) or srec_cat when automating builds in Makefiles. Using Adawaty Pro gives bench technicians the same byte-accurate conversion directly in a browser on any repair workstation without installing GCC toolchains:
# GNU Binutils CLI equivalent (BIN <-> Intel HEX):
arm-none-eabi-objcopy -I binary -O ihex --change-addresses 0x08000000 firmware.bin firmware.hex
arm-none-eabi-objcopy -I ihex -O binary firmware.hex firmware_rebuilt.bin
# Verify byte-for-byte identity after round-trip conversion:
sha256sum firmware.bin firmware_rebuilt.bin
Verifying Flash Chip Boundaries & Bootloader Alignment
Before writing a reconstructed .bin back onto an 8-pin SPI NOR chip (such as a Winbond W25Q64JV or Macronix MX25L12835F), confirm that the byte length matches the exact flash capacity—for example, 8,388,608 bytes for 64 Mbit or 16,777,216 bytes for 128 Mbit. If a hex patch shifted bytes by even one nibble, the microcontroller reset vector at address 0x00000000 will jump into invalid opcode space and brick the board until recovered with an external hardware clip.
Frequently Asked Questions
A plain ASCII hex dump lists raw two-character byte pairs separated by spaces (such as 4D 5A 90 00). Intel HEX adds structured ASCII records starting with a colon (:), carrying byte count, 16-bit load address, record type (00 for data, 01 for EOF), data payload, and a two's-complement checksum byte at the end of every line.
Microcontroller flashers need exact byte-to-address mapping. BIN files imply a contiguous layout starting at address 0x0000, whereas Intel HEX lets compilers skip unused flash regions and verify transfer integrity over serial lines using per-line checksums.
When converting HEX back to BIN, the parser strips whitespace, 0x prefixes, and non-hex punctuation, then pairs every two nibbles into one byte (0x00–0xFF). If the cleaned string has an odd number of hex digits, the trailing single nibble is ignored to prevent byte misalignment.
Every single raw byte (8 bits) expands into two ASCII characters (16 bits) in hexadecimal notation, plus optional spaces, line breaks, and address/checksum framing—typically increasing disk size by 2.2x to 3x without adding any new binary information.