Inspect, search and edit binary files

Hex Editor with Binary Templates

Open a binary file of up to 2 GB, read it as hex and text, decode the bytes under the cursor, colour its structure with a template for PNG, ZIP, ELF, PE and more, and save an edited copy. Only the part you look at is loaded.

File

Drop a file to open

Any file up to 2 GB. It is read in slices, never loaded whole.

Hex Editor with Binary Templates

Operator: Abdulla Al Fahad. How tools are built and checked

A hex editor is the tool you reach for when a file will not open, a checksum fails, or you want to know exactly which bytes a program wrote. This one opens files of up to 2 GB without loading them: the view reads 64 KB pages on demand, so scrolling a multi-gigabyte disk image costs about as much as scrolling a text file.

Beside the hex and ASCII columns sit a data inspector for the bytes under the cursor, byte-pattern search with wildcards, a byte-level comparison with a second file, an entropy graph, and structure templates for eleven formats that colour the bytes by field.

Key features

  • Hex and ASCII view, 16 bytes per row, with a position slider because a 2 GB file has 134 million rows, too many for a normal scroll bar
  • Data inspector: signed and unsigned integers of 8 to 64 bits in both byte orders, float16, float32 and float64, ULEB128 and SLEB128, UTF-8 and UTF-16 text, Unix, DOS and Windows FILETIME times and GUIDs
  • Overwrite and insert editing with 400 levels of undo, bookmarks, go-to by hex, decimal or relative offset (+16, -0x40), and Save as new file
  • Search for hex bytes with ?? wildcards, UTF-8 or UTF-16 text, and integers or floats of a chosen width and byte order, across the whole file with Cancel
  • Templates for PNG, JPEG, GIF, BMP, ZIP, GZIP, PDF header and xref, ELF, PE, WAV and MP4 boxes; the format is guessed from the first bytes
  • Byte histogram, Shannon entropy and a 128-block entropy graph for the file or a selection, and a byte-level diff against a second file

How large files are opened and what a template reads

Edits are kept in a piece table: a list of pieces, each pointing into the original file or into a buffer of bytes you typed. Overwriting, inserting and deleting split and rearrange pieces without moving the file's data, which is why inserting a byte near the start of a 1 GB file does not copy the file. Saving builds a new Blob from slices of the original and your buffer, so it needs little memory beyond what you added; typed and inserted bytes are capped at 256 MB. The view asks for 18 rows at a time; original bytes come from a cache of 96 pages of 64 KB, and search and entropy read in steps of 1 MB and 4 MB, with search overlapping each step by the pattern length minus one byte so a match across two reads is found once.

A template is a short program that walks the file with a cursor and records one field per read: name, offset, length and a decoded value. Where the format has a checksum the template recomputes it. The PNG template does this for every chunk up to 1 MB and shows whether the stored CRC-32 matches. The ZIP template finds the end-of-central-directory record in the last 64 KB, follows the central directory (and the ZIP64 locator when the 32-bit fields hold 0xFFFF or 0xFFFFFFFF) and lists local headers in file order.

Templates stop cleanly when the file ends inside a structure and say where. A template shows at most 20,000 fields, ELF and PE show up to 512 and 96 section headers, and ZIP lists up to 3,000 entries.

Common use cases

  • A modder finds that a 4-byte little-endian 1500 at a known offset sets a unit's cost. Searching the integer 1500 with width 4 lists its occurrences, and the inspector confirms the neighbouring field reads as a sensible float32.
  • A developer debugging a corrupt download opens the 1.4 GB capture in this tool, drops the intact copy into Compare, and sees one range of 4,096 changed bytes at 0x1C000000 instead of a failed checksum with no location.
  • A security analyst checking a 1 MB executable runs the entropy graph and sees a block near 7.99 bits per byte after the section headers, then applies the PE template to find which section that offset belongs to.
  • A support engineer opens a customer's .zip that Windows reports as damaged, applies the ZIP template and sees that the end-of-central-directory record is missing from the last 64 KB, so the file was cut short.

How to use this tool

  1. Drop a file, or open the 890-byte PNG the page builds in your browser.
  2. Click a byte and read the Inspector tab, or open Template and choose Apply template to colour the fields.
  3. Edit by typing hex digits, search or compare in the other tabs, then choose Save as new file.

Example

The built-in example.png (890 bytes), then overwrite the byte at 0x13 with 20 and apply the PNG template

Go to 0x13, type 2 0 in overwrite mode (the width field at 0x10-0x13 changes from 16 to 32), choose Template > PNG > Apply template

IHDR chunk fields

Width=32, Height=16, Colour type=2 truecolour
CRC-32 stored 0x90916836, does not match (computed 0xF862EA0E)
Searching UTF-8 text "hex editor example" before the edit finds it at 0x31 (49)

Tips for best results

  • Click a field in the template tree and the hex view selects exactly its bytes, which is the quickest way to see how long a field is and what follows it.
  • Go to accepts relative offsets: type a field's offset, press Go, then type +0x20 to land 32 bytes past it. That is how you follow a length or pointer field to the data it describes.
  • Wildcards are whole bytes. 4D 5A ?? 00 matches any third byte; to match a single nibble, search both candidate bytes.

Common pitfalls

Edits do not repair checksums, sizes or offsets. Changing a PNG chunk or a ZIP entry leaves the stored CRC-32 as it was; the template tells you it no longer matches, and fixing it is up to you.

Insert mode shifts every later byte, so any absolute offset stored elsewhere in the file (an ELF section table, a PE pointer) will point at the wrong place afterwards.

Common errors and how to fix them

This editor opens files up to 2 GB
The file is larger than 2,147,483,648 bytes. Split it first with a command-line tool and open the part you need.
"is not hex" or "has an odd number of digits" in Search
Hex patterns are made of whole bytes: write 4D 5A or 4d5a, and use ?? for a wildcard byte. A single digit such as 4 is not a byte.
The file ends inside this structure
The template reached the end of the file while a field was still being read, so the file is truncated or is not that format. Fields found before that point stay on screen.

Best practices

  • Bookmark every offset you will return to before you start inserting or deleting; bookmarks keep their numeric offsets and do not move with the bytes.
  • Run the template again after each structural edit so the colours and stored-versus-computed checksums reflect the bytes you are about to save.

Frequently asked questions

Can it change the file in place?

No. A web page cannot write over a file on your disk without asking for each save, so the editor works on a copy in memory and Save as new file offers a download named like photo-edited.png. Your original is never modified.

Why is there a slider instead of a scroll bar?

Browsers cannot make an element tall enough for 134 million rows (browsers stop at roughly 17 to 33 million pixels per element, depending on the engine). The mouse wheel, the arrow keys, Page Up and Page Down and the slider all move a row index instead, which works for any size up to 2 GB.

How exact is the entropy figure?

It is the Shannon entropy of the byte histogram, computed over every byte in the range and reported in bits per byte, so 8.0 means all 256 values are equally common. Text sits near 4.5 and compressed or encrypted data near 7.9 or more. The graph averages 128 equal blocks, so a short run of random bytes can be hidden inside a block.