Binary file hexadecimal editors ("Hex Editors") designed to run in DOS

These are editors that work with a file in "binary mode", meaning they work with the bytes directly instead of trying to parse a file in "text mode" which may cause new line characters to be altered (inserting or removing either CR or LF, I offhand don't remember which, however the program is designed to). They will typically have some good support for viewing and inserting control and high ASCII characters.

MS-DOS Editor 2

The MS-DOS Editor 2.0.026 that ships with Windows 98 Second Edition and Windows Millenium Edition has built in support for opening a file and treating it as a "Binary File", not just a "text file". This can be done simply by going to File, Open, and checking the "Open Binary" checkbox. If checked, a "Line Width" field is also enabled, defaulting to 70 columns wide.

This does seem to operate the same as the documented (with Edit/?) command line parameter of /# (where the number can impactfully range from 1 to 1021) for how many columns wide to load a file in binary mode. Interestingly, the 257,520 byte 4DOS 7.50 Freeware 4DOS.Com file could be used as a data file that Edit /70 could load just fine, but when using Edit /3 there would be a dialog box of the file being too many "lines" long and so it wasn't fully loaded. Therefore, it would seem the number of columns per line can be impactful. Just like the older MS-DOS Editor, this version supports binary characters by prefacing them with Ctrl-P. So, Ctrl-L (or Alt plus 12 on the numpad) pulls up the Find dialog box, but Ctrl-P causes the program's toolbar to say "Enter the control key to insert".

I haven't played with this much to learn more about how it works: Inserting a character on one line makes the line longer (so it shows up longer on the screen than the other lines that are still bound by the Line Width value), instead of wrapping and adjusting all other lines. Since I haven't tested this more thoroughly, I still learn towards using a standard hex editor if I plan to do anything more complicated, like searching and replacing strings of different length. The primary advantage of this editor may just be that it is conveniently pre-installed. To see if unintentional bytes were changed, one could use “FC /B file1.ext file2.ext” because FC is likely included with most systems that have this software installed.

To check the version number, one can go to Help, About or just run Edit /?. The older MS-DOS Editor, where the Edit.Com simply ran QBASIC/EDITOR (or perhaps less, since as much as the last 4 letters of the command line switch could be removed), only supported opening one file and, to my knowledge, did not have this sort of "Binary File" support.

debug.exe

As an alternative, debug.exe is said to work nicely and be automatable with batch files. Note that this may not be the simplest solution, and a tutorial/walkthrough is not currently available here. This is only mentioned for consideration by those willing to invest in exploring this option. Because using debug.exe may not be simple and may have some side effects if it isn't used properly, this is not recommended for casual use.

The option of using debug.exe may be useful for rather automated methods, namely since the debug command might come with some operating systems. However, blindly relying on debug working on many systems just because it worked on one system is not recommended. There might be some problems like an executable file being missing or being a version that won't run because it detects that it is from another operating system. (Using SETVER.EXE might help to alleviate that issue, at least somewhat.) At the time of this writing, compatibility between different versions has not been extensively tested by the author of this text. It might also be the case that different versions of debug might not be compatible enough for some common scripts to work in a compatible fashion, so the commands that work with one might not be work with all other standard debug.exe files.

Hex

This closed-source software works with DOS operating systems, as well as newer operating systems capable of running that sort of software. Hex 5.1a (local) (from here) (April 12, 1995 release) is a version "provided by Jon Durward "as is"", and has been on numerous public software distribution channels, so it does certainly appear legal to distribute.

The newer version has become known as HexTool by the time version 5.2a rolled out and has command line support, and is crippled. Version 5.2b exists. hex52as.zip seems to be a stripped down version of 5.2a.

Some bugs in 5.1: I found what appeared to be a couple of endless loops releated to Search And Replace: Replacing \n\r with \n\r</P><P>\n\r (presumably because the newly inserted string led to the match being found after the string start), and replacing a flag character of FF. Also, it may not find a match occuring at the very end of the file (such as if replacing a single character).

Mogsy's Guide to Hex Editing shows a picture of this software, using a built-in converter between binary and octal and hexadecimal.

HexEdit from Morgana's Cavern
Morgana's Cavern includes Pascal source code. This is “for the PC” according to the page that is called “Windows Samples” on the domain's home/top page. Permission is required to distribute. http://pascal-central.com/pc/hexedit.zip
TDE (the “Thomson-Davis Editor”)

The TDE home page offers executables and source code. FreeDOS info on this cites the software as public domain, as does the readme.txt file with the binaries and the readme_s.txt file with the source code. The program has support for editing binary files, although it doesn't show the hex codes for characters like Hex 5.1a does. There are versions for DOS and Win32, and the source code is also meant for Linux. This is a binary file editor. The readme.txt lists the various executables. Using /? shows some commands available. Using Ctrl and backslash loads the menu. (Sub-menus may be expanded with enter, not with right arrow). This provides information on a number of hotkeys, such as for customing tabs (found by choosing “Tabs” under the “Word” menu). In addition to /?, which works like -?, there is --help, -??, -G? (or -g?). The program's documentation is available as a separate download from the actual program, including a package with web pages (including an index.html file).

A blank file doesn't seem to work (the -s option for scratch doesn't seem to have any effect), but a new filename may be specified, and then a scratch file may be loaded with File, Scratch.

beav (Binary editor and viewer)
This is available for multiple platforms, and is said to be like emacs.
gsar

general search and replace

Can be used on multiple platforms

GPL2

This program provides a command line ability to replace bytes.

Grab from: Tormod Tjaberg's page.

The local gsar1201.zip contains versions 1.21 and 1.20. Version 1.21 mentioned removing some documentation, so 1.20 may provide those removed details (which might satisfy curiousity, even if the details are otherwise useless with newer software).

Others
The only software found on both Old SimTel collection of binary editors (with a few more, edrhr15?.zip and goed10.zip and sled11.zip, being found in the ../editors area from there) and Editors for FreeDOS are beav, and maybe hexedit, and xed.
Other software

Users of 32-bit Windows may use the DOS software above.

Users of 32-bit or 64-bit versions of Microsoft Windows may want to use seder's Super-sed, a version of which has been run through UPX 3.94w with --ultra-brute and then is being distributed at seder's Super-sed 3.62 UPXed.

http://www.freebsdsoftware.org/editors/ has some more software.