Skip to content
bitRAKEPublic

About

Hexadecimal file editor for Windows 11.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

hexed

hexed editing a binary file

hexed is a compact console hex editor for existing files. It displays sixteen bytes per row, supports hexadecimal and character entry, and keeps changes in memory until you explicitly write or restore them.

hexed <file>

There are no command-line options. Quote a path containing spaces.

Requirements

  • x64 Windows 10 or Windows 11
  • Windows Terminal or another console host with VT-sequence support
  • a window at least 76 columns wide and four lines high

The executable uses PE subsystem version 10.0 and is intentionally aimed at modern Windows console environments.

Editing model

hexed edits bytes in place. It never inserts, deletes, appends, or resizes the file.

Only the bytes in the visible view can be edited. Changes remain pending in memory until you press F2; F5 restores the snapshot loaded for the current view. Retyping a byte's original value removes that byte from the pending changes.

Scrolling, jumping, and resizing proceed without interruption when the destination still contains every changed byte. The pending span is rebased into the new view and remains highlighted.

A request that would move any changed byte out of view—or exit the program—is held:

changes pending in this view:  W write   R restore   Esc cancel
  • W writes the pending span and continues the requested action.
  • R restores the loaded snapshot and continues.
  • Esc cancels an ordinary navigation request.

A resize that would exclude a changed byte has already happened and therefore cannot be cancelled; its prompt offers only write or restore.

F2 writes directly to the original file and flushes it. There is no backup and no undo after a write. If the file cannot be opened for writing, hexed opens it read-only and refuses data entry.

Ctrl+Break and closing the console cannot stop for a prompt. They safely discard pending in-memory changes, restore the terminal, and report the discard on exit.

Controls

Key Action
← → move one byte within the view
↑ ↓ move one row; scroll at the top or bottom
PgUp PgDn move by one screen
Home End move to the start or end of the row
Ctrl+Home Ctrl+End move to the start or final page of the file
Tab switch between the hexadecimal and character panes
F1 open or advance help; one press past the final page closes it
F3 select the next configured single-byte code page
F4 rotate through float, signed, and unsigned data forms, then close
0–9, A–F enter a nibble in the hexadecimal pane
printable ASCII enter a byte in the character pane
F2 write pending changes
F5 restore the loaded snapshot for this view
F6 show offsets in hexadecimal or decimal
Ctrl+G go to an offset, typed in the footer's offset field
mouse wheel scroll three rows
left click place the cursor
Esc close an open help/data panel, or cancel a navigation prompt
Esc Esc request exit; pending changes still require a decision

Character-pane entry accepts bytes 20h through 7Eh. Use the hexadecimal pane to enter all other byte values.

Reading the screen

The fixed 76-column layout contains an address, sixteen hexadecimal bytes, and their character interpretation:

  offset  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  0123456789ABCDEF
00000000  48 69 21 0A FF                                    Hi!..

F6 shows the offsets in decimal, right-aligned in nine columns, and the ruler says so. An offset of ten digits keeps its low nine there; the footer has all of it.

 decimal  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  0123456789ABCDEF
      240 F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF  ≡±≥≤⌠⌡÷≈°∙·√ⁿ²■

Changed bytes are highlighted. The real terminal caret is placed on the nibble or character that will receive the next keystroke.

The compact footer contains only:

  • file name
  • total bytes
  • active code page, such as cp437
  • Tab pane
  • F1 help
  • at its right end, the offset of the byte under the cursor: 0x and eight hex digits, or decimal after F6. This field always shows the whole offset, whatever the address column has room for.

Ctrl+G turns that field into an entry line:

  • In hex mode it starts as 0x, saying hexadecimal is expected; Backspace removes it.
  • In decimal mode it starts empty.
  • Either way, $ or 0x before the digits, or h after them, makes them hexadecimal: 0x1F0, $1F0, 1F0h and 496 all go to the same byte.
  • Enter goes there. An offset past the end goes to the last byte.
  • Esc closes the line without moving.
  • Text that is not an offset yet, such as a lone x, leaves it open.

F1 moves the footer four rows higher and displays four lines of help beneath it. The help remains visible while editing. Each additional F1 press advances by four lines; pressing F1 once beyond the final page closes help and returns those four rows to the data view.

F4 uses the same persistent four-line area to interpret bytes beginning at the active byte. Its pages are:

  1. IEEE f16, f32, f64, and x87 f80 floating-point values
  2. signed s8, s16, s32, and s64 integers
  3. unsigned u8, u16, u32, and u64 integers

The selected family receives the wide value field while the other two families remain as row labels. Integers are little-endian, comma-grouped decimal. Float output preserves signed zero, infinity, and NaN, and uses grouped scientific notation for very large or small values. Fixed notation separates integer thousands with commas and fractional digits into three-digit space groups. A form whose complete 2-, 4-, 8-, or 10-byte representation is not in the loaded view displays n/a.

F1 and F4 panels are mutually exclusive: pressing the other key switches panels without changing the four-row geometry. Moving or editing the active byte updates an open data-forms panel immediately. Esc closes either panel from any page. That release remains the first half of Esc Esc, so an immediately following Esc requests exit; any intervening released key breaks the sequence.

Character interpretation

The right-hand pane interprets every byte through a Windows single-byte code page. The console output code page in effect when hexed starts becomes the first choice when it is single-byte, so the shell can select the initial view:

chcp 866 >nul
hexed file

F3 cycles through that captured page and the favourites compiled into HEXED_CODEPAGES in hexed.h. The supplied favourites are CP437, CP850, and Windows-1252. Unsupported, multibyte, and duplicate pages are skipped; CP437 is the fallback when the startup page is unsuitable.

Byte mappings that Windows rejects, plus Unicode C0 and C1 control characters, are shown as coloured dots rather than being sent to the terminal. Display output itself is UTF-8; the original console output code page is restored on exit.

Window behavior

The editor uses sixteen bytes per row and therefore owns a fixed width of 76 columns. It asks the terminal to take that width while running and restores the original width and height on exit. Height is dynamic: every line beyond the ruler and footer becomes another data row. An open help or data-forms panel reserves the bottom four lines, so the visible data view is four rows shorter until the panel is closed.

If the console host refuses resizing, a wider window is used from its left edge. A narrower window displays a size warning and recovers when sufficient space is available.

Started with a console of its own (from Explorer, Run, or a shortcut), hexed centres its window on the mouse pointer, inside that monitor's work area. This applies to Windows Terminal and to the classic console host alike. Started from a shell, it shares the shell's console and leaves the window where it is.

hexed uses the alternate screen buffer, leaving the shell's original screen and scrollback intact. On exit it prints one lasting summary:

hexed: C:\path\file.bin: 1 byte written
hexed: C:\path\file.bin: unchanged
hexed: C:\path\file.bin: unchanged, 3 pending bytes DISCARDED

Limitations

  • Existing files only; no creation or resizing.
  • Files of 4 GiB and larger are refused because addresses are eight hex digits.
  • Character-pane input is printable ASCII; use hex entry for the full byte range.
  • Correct startup depends on a console host delivering window-size events after the alternate screen is activated.
  • Terminal resizing and restoration depend on host VT support.

Building and development

This is the low fixed-base port of bitRAKE/hexed on this repository's PSDK projection. From the repository root:

examples\_build.cmd hexed

Assembler architecture, binary-format policy, what the port changed, and the verification record are in DEVELOPING.md. Features still being thought through are in roadmap.md.

About

Hexadecimal file editor for Windows 11.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Contributors

Languages