Part 3 · Advanced features / 3.3

Hexadecimal and binary editing

Ctrl+P lays the current document out byte by byte. Files that were never text open straight into that view — and there you really can edit the bytes. The rules for the two cases differ.

Reading time about 14 min Audience Anyone who needs to see bytes Prerequisites 3.1 Version v1.0 ・ 2026-08-26
3.3.1

Two ways in

You press Ctrl+P, or Erya works out that the file was never text.

① Ctrl+P on a text file

Read-only. What you see is exactly what a save would write: the BOM, the current encoding, and LF or CRLF endings.

Ctrl+P again, or Esc, returns to text editing with the cursor on the same byte.

② A binary file opens here

Files that cannot be decoded as text, or that contain NUL bytes, start in this view — and cannot leave it, because there is no text to edit.

Below 64 MiB the bytes are editable; above it the file stays streamed and read-only (see 3.3.8).

Why the view is read-only for text files

A text document lives in a text buffer; the bytes are only a rendering of what it would become on disk. To edit bytes directly, the file has to be a binary file in the first place. To change a byte in a text file, edit the character, or change the encoding with F7 (see 3.1.2).

3.3.2

What is on the screen

Three columns: offset, bytes, printable characters.

爾雅 Erya │ [report.txt]
W 16/32 bytes O dec/hex offsets Ctrl+G/G go to offset Ctrl+P/Esc back
00000000 48 65 6C 6C 6F 2C 20 E4 B8 96 E7 95 8C 0A 41 42 |Hello, .......AB| 00000010 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 |CDEFGHIJKLMNOPQR| 00000020 53 54 55 56 57 58 59 5A 0A 0A E5 B7 A5 E4 BD 9C |STUVWXYZ........| 00000030 0A |. |
Offset 0x1F / 0x31 │ 16 bytes per row │ Hex │ UTF-8 │ report.txt
Switched to the hexadecimal view (read-only)
ColumnWhat it shows
OffsetThe position of the first byte on this row. At least eight digits, zero-padded, so short files still look like a classic dump.
BytesTwo hexadecimal digits each, in groups of eight with an extra space between groups for counting. Missing bytes at the end of the file are blank.
CharactersFramed by |. Printable ASCII appears as itself; everything else is a . — so CJK text shows as runs of dots, one per byte.

The status bar takes a form of its own: offset current/total │ bytes per row │ view kind │ encoding or mode │ filename. The byte under the cursor is highlighted in both columns at once.

3.3.3

Four keys in the read-only view

Movement works as usual; four keys belong to this screen.

KeyWhat it does
WSwitches between 16 and 32 bytes per row. 32 needs a 144-column terminal; in a narrower window it stays at 16 and says “The terminal is too narrow; 32 bytes per row need 144 columns”.
OShows offsets in decimal or hexadecimal. “Offsets now shown in decimal”.
G or Ctrl+GJumps to an offset (see 3.3.4).
Ctrl+P or EscBack to text editing.
Arrows / PageUp PageDownMove by byte, row, and page.
Home EndFirst or last byte of the row.
Ctrl+Home Ctrl+EndStart or end of the file.
Only the visible part is read

The hexadecimal view never loads the whole file into memory; it reads the section you are looking at. Opening a several-hundred-megabyte file this way is instant.

3.3.4

Jumping to an offset

Four notations, because decimal and hexadecimal are so easy to confuse.

Enter confirm Esc cancel ←/→ move caret Backspace/Delete edit
Go to offset (hexadecimal, 0x prefix allowed): 1F40
You typeHow it is read
1F40In whatever base the offset column is using. The prompt says which that is.
0x1FAlways hexadecimal
$1FAlways hexadecimal
1FhAlways hexadecimal
0d31Always decimal
  • On success: “Jumped to offset 0x1F”.
  • Malformed input gives “Invalid offset; enter a number, or prefix it with 0x for hexadecimal” and asks again.
  • An offset past the end stops at the end.
When in doubt, use a prefix

Offsets copied from other tools (xxd, a debugger, a format specification) are usually hexadecimal, so adding 0x is the safe habit — no need to check which base the column is in.

3.3.5

Binary files open here automatically

The test is simple: is there a NUL byte in the first 8 KiB?

爾雅 Erya │ [logo.png]
0-9A-F edit I ovr/ins BS/Del delete W 16/32 O dec/hex G offset F11 close
00000000 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 |.PNG........IHDR| 00000010 00 00 01 90 00 00 01 90 08 06 00 00 00 80 BF 36 |...............6| 00000020 CC 00 00 00 09 70 48 59 73 00 00 0E C4 00 00 0E |.....pHYs.......|
Offset 0x0 / 0x4A21 │ 16 bytes per row │ Binary │ Overwrite │ logo.png
Opened binary file logo.png (19 KB) in the editable hexadecimal view
  • The hint bar switches to the byte-editing set, and names the way out at the end of it.
  • The second status cell reads Binary (not “Hex”), and the third is Overwrite, Insert, or Read-only.
  • Esc does not return to text editing, because there is none. It simply repeats the exits: “A binary file can only be read in the hexadecimal view; F11 closes the tab, Ctrl+X quits”.
UTF-16 files are not treated as binary

UTF-16 text is full of NUL bytes and looks very much like a binary file. Erya recognises the pattern and reports an unsupported text encoding instead — rather than presenting it as editable bytes, which would invite you to damage a perfectly good text file (see 3.1.1).

3.3.6

Changing one byte

Type two hexadecimal digits: the high nibble, then the low one.

  1. Put the cursor on the byte. It is highlighted in both columns.
  2. Type the first digit. For 4A, press 4 — the high nibble is set.
  3. Type the second. Press A; the byte becomes 4A and the cursor advances.
  4. The two presses are one undo step. A single Ctrl+Z restores the original value, never half of it.
Pressing a key that is not a hexadecimal digit

You get “Type a hexadecimal digit (0-9, A-F) to change a byte”. Only 0–9 and A–F write anything (either case).

Save, undo, redo, and Save As all use their usual keys (Ctrl+S, Ctrl+Z, Ctrl+Y, F12). A binary document has no text buffer, so encoding conversion, line-ending conversion, and comparison do not apply; pressing those keys gives “The hexadecimal view does not support this action”.

3.3.7

Inserting and deleting bytes

This screen has its own I key, because Mac keyboards have no Insert.

KeyWhat it does
I (or Insert)Switches between overwrite and insert. The third status cell follows.
BackspaceDeletes the byte before the cursor
DeleteDeletes the byte under the cursor

Overwrite (the default)

Typed bytes replace what was there; the file length does not change.

Use this for structured formats — PNG, ZIP, firmware — where the length has to stay put.

Insert

Typed bytes are inserted, pushing the rest along; the file grows.

In insert mode the cursor may sit past the last byte, which is how you append.

Back the file up before you edit it

Erya has 100 undo steps, but the file format usually has no tolerance at all: one byte of length difference, a checksum left stale, and the file is broken. Press F12 for a copy first, or duplicate the original outside Erya.

3.3.8

Big files stay streamed and read-only

The same 64 MiB line as for large text files.

FileOpens asEditable?
Binary below 64 MiBBytes held in memoryYes: change, insert, delete, undo, save
Binary at 64 MiB or moreStreamed from diskNo, read-only. The third status cell says Read-only
  • Opening a large binary reports “Opened binary file disk.img (4.2 GB) in the read-only hexadecimal view”.
  • Attempting to change something gives “This binary file is read-only and cannot be changed”.
  • The hint bar switches to its read-only variant, ending in the word “read-only”.
The line exists to bound memory

Editable means the whole byte sequence has to be in memory. Erya would rather keep a large file read-only than exhaust your machine when you open an 8 GB image — the same trade-off as for large text files (see 3.2.3).

3.3.9

Common problems

Seven situations in the hexadecimal view.

SymptomCause and fix
You cannot edit a text file's bytesThe view is read-only for text files (3.3.1).
Esc does not take you backIt is a binary file; there is no text editing to return to. F11 or Ctrl+X (3.3.5).
W will not give 32 bytesThe terminal is under 144 columns. Enlarge it and press again (3.3.3).
A jump lands somewhere unexpectedThe input was read in the other base. Use the 0x prefix (3.3.4).
A letter key says “type a hexadecimal digit”Only 0–9 and A–F change bytes (3.3.6).
CJK text is a row of dotsThe character column shows printable ASCII only; multi-byte characters become dots (3.3.2).
The file no longer opens after editingBinary formats care about length and checksums. Restore your backup (3.3.7).