Hex Editing

Hex-based corruption is one of the most direct and controllable ways to create glitch art by editing the raw bytes of a file instead of using conventional image software.
This guide explains what hex editing is, how glitch corruption works, common techniques and tools, and practical tips for consistent, repeatable results.
What is hex editing in glitch art?
A hex editor is a program that lets you view and change a file’s raw bytes, usually displayed as hexadecimal values (00–FF) alongside an ASCII text view. Instead of pixels, layers, or filters, you work directly on the underlying data.
When used for glitch art, hex editing is a form of databending: deliberately corrupting a file’s data to produce visual (or audiovisual) errors for aesthetic purposes.
Key ideas:
- You are not “drawing” on the image; you are breaking its structure in controlled ways.
- Small changes to certain regions create colorful streaks, misalignment, and compression artifacts; changes to the wrong regions can destroy the file completely.
How corruption via hex editing works
Most media formats have a similar internal structure:
- Header / metadata at the start: format signatures, dimensions, color space, compression info, etc.
- Footer / end markers at the end: “file is finished” signals (for example, JPEG EOI marker).
- Payload / data body in the middle: pixel, block, or frame data where visual corruption is usually safest.
Glitch aesthetics come from how the decoder misinterprets altered bytes:
- In JPEGs, data is compressed into blocks; corrupting the compressed data can produce characteristic blocky streaks or color smearing while the decoder struggles to reconstruct the image.
- Corrupting headers or essential markers can cause extreme distortions, broken color spaces, or complete failure to open the file.
The art is in finding sweet spots where the decoder still functions but “misreads” your altered data.
Tools for hex-based glitching
Popular options include:
- Desktop hex editors
- wxHexEditor, HxD, Hex Fiend, 010 Editor, etc. These show hex + ASCII side by side and allow precise selection, search, and replace.
- Online hex editors
- For example, Hexed.it, often recommended for quick experiments in the browser.
- Supporting tools
- A basic image editor (GIMP, Photoshop, etc.) to resize/prepare source images before corruption.
- Random hex generators or scripts to generate values to paste into the file.
Core techniques
1. Safe workflow and file preparation
- Always work on copies. Make multiple duplicates of your source file; hex edits are not meaningfully “undoable,” and interesting glitches can be non‑repeatable.
- Resize and compress first. Pre‑processing the image (scale, crop, re-save with different JPEG quality) influences how the corruption manifests, especially for compressed formats.
- Use robust formats for aggressive glitches. Raw or lightly structured formats tolerate harsher corruption than heavily structured ones.
2. Target the data region, not the header
A common beginner approach:
- Open the image in a hex editor.
- Identify the header zone at the top (often very structured, sometimes readable ASCII: “JFIF”, “Exif”, dimensions, etc.).
- Scroll past this into the “random-looking” area - that is usually the image data.
- Edit only the data region at first.
Typical edits:
- Overwrite bytes with random hex values (00–FF).
- Copy and paste chunks of bytes within the data area to create repeated visual bands or misalignment.
- Delete small chunks to introduce horizontal tearing or shifts, especially in JPEG/MP4 files.
If the file stops opening, you likely damaged the header or critical markers; revert to a backup and stay deeper in the data region.
3. Surgical header manipulation
Once you are comfortable, you can start selectively attacking the header to create more structural glitches:
- Tamper with compression parameters in JPEGs. Changing values that control quantization or Huffman tables can produce dramatic, format-specific distortions.
- Copy headers between files of similar type and size, creating mismatched interpretations of the same data.
- Alter dimension or color fields to attempt stretching, color channel mis-mapping, or aspect-ratio chaos. This is fragile and often breaks the file entirely, but can yield strong effects.
This level of editing benefits from having a format specification or at least examples to compare: open a clean and a corrupted copy side-by-side and watch which bytes change.
4. Hybrid databending flows
Hex editing combines well with other databending methods:
- Open an image as audio (e.g., in Audacity), apply sound effects, export, then refine the resulting file in a hex editor.
- Use scripts or libraries (e.g., Python-based glitch tools) to randomize or pattern-edit certain byte ranges, then manually “tune” interesting sections by hand.
Practical tips for better results
- Work incrementally. Make small, localized edits, save as a new file, and preview. Build a stack of versions rather than over-editing one.
- Note byte ranges. When a region produces a pleasing glitch, write down its approximate offsets (e.g., 0x4000–0x5000) so you can revisit or automate similar transformations.
- Keep backups of “almost broken” files. Files that barely open often have especially unstable and interesting structures you can reuse or layer.
- Experiment with different formats.
- JPEG: blocky, smeared, “datamosh-like” errors.
- PNG: more brittle, but can still yield sharp, geometric glitches when CRCs and chunks survive.
- BMP / raw: tolerant of heavy corruption; great for bold tearing and channel chaos.
- Embrace non-repeatability. Hex glitches are often emergent: slight differences in byte location, compression, or viewer can change the output. Treat the process like analog destruction rather than deterministic design.
By combining disciplined backups, knowledge of file structure, and playful destruction, hex editing becomes a precise yet chaotic instrument for glitch art, giving you direct access to the “bones” of the digital image.