UltraEdit is well-known for being an excellent text editor. However, it is also an extremely popular hex editor. In fact, UltraEdit appears at so-called “position zero” for the search “best hex editor.”
Despite that, hex editors are generally not as well understood as text editors. And since many of the other hex editors on the market are dedicated hex editors, we wanted to dedicate an article to talking about what hex editors are and the things you can do with them.
Table of Contents
What is a Hex Editor?
A hex editor is a special type of editor that can open any type of file and display its contents, byte by byte.
Most of the time when you open a file, you are seeing the program’s interpretation of that file’s contents. Even plaintext files contain invisible characters that denote the beginning of the file, where lines should break, the end of the file, and more.
You can see these invisible characters (and regular characters, too) with a hex editor, where they appear as hexadecimal values.
What is Hexadecimal and Why Do We Use It?
The “hex” in “hex editor” is short for hexadecimal, which is a base-16 number system. It’s a little confusing, but we’ll do our best to explain.
Base 16 is a number system with the number 16 as the base, hence the name. The easiest way to understand base 16 is to understand bases 60 and 10. Luckily for us, you’re already familiar with both of them.
Base 10 is the number system we’re most familiar with. In base 10, everything is a multiple of ten. In base 10, you add digits in multiples of ten. 1-9 gets one digit, 10-99 get two digits, 100-999 gets three digits, and so on. Base 10 is also just called “decimal.” Another way to think about base 10 is that everything is a fraction with ten at the bottom. .5 is actually 5/10. 1 is actually 10/10. 2 is actually 20/10.
Base 60 is the same as base 10, except 60 is the key number. If that sounds confusing, don’t worry—you’ve known base 60 your whole life, because base 60 is how we tell time. Every minute of the hour is actually a fraction with 60 at the bottom. 1:45 is 1 and 45/60, or 1 and .75 of an hour. That’s why filling out decimal-based time cards is so difficult. It’s easy to think that 15 minutes = .15 hours, but .15 hours is actually 9 minutes! That’s because .15 hours is written in base 10, but 9 minutes is written in base 60 (9 minutes is actually 9/60th of an hour)
Base 16 is the same as bases 10 and 60, except this time 16 is the key number. To count to 16 in base 16 goes like this: 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10. It’s confusing, but “11” is actually “B” in hexadecimal; likewise, “A” in hexadecimal would be “10” in decimal. Put another way, 110/10 (base 10) is the same as 176/16 (base 16). It’s confusing to convert between base 10 and base 16, so your best bet is to use a converter like this one. However, it’s incredibly easy to convert between base 2 (also called “binary”) and base 16, which is why we use it.
We use hexadecimal because it’s a good compromise between base 10 and base 2. Base 2 is the language of computers. There are only two numbers in binary: 1 and 0. The number “2” in base 10 is represented as 0010 in binary, the number “3” in base 10 is 0011 in binary, and so on. If you look at binary, you’ll begin to notice that binary takes several digits to represent what only takes one or two digits to represent in base 10. 17 in base 10 (two digits) is 0001 0001 (eight digits) in binary. It’s easy to see that pure binary quickly becomes unmanageable. But to convert from base 10 to base 2 and back is complicated. Even if a computer could do the work, it would take quite a while, slowing down all processing tasks.
Hexadecimal, on the other hand, is the perfect blend of readability (many numbers can be represented in hexadecimal with a two-digit pair) and ease of conversion (it is trivial to convert between binary and hexadecimal—you only have to multiply or divide by eight!). If you want a much more in-depth description of how hexadecimal came to dominate the computing world, read this post by Nikolai Savas.
So, when you see the hex values of a file, you are actually seeing the individual bits that make up that file, converted into hexadecimal. Now that the fancy explanation is out of the way, what are hex editors good for?
Fix Corrupted Files
When a file gets corrupted, like, say, an audio file does when it won’t play, you often don’t get any insight into what’s actually wrong with the file—you just know that it is broken. However, you can view the file’s bytes and diagnose the issues with a hex editor.
That’s exactly what YouTube user Stephen Chapman did in his “Introduction to Hex Editors and Scripting” video. In the video, Chapman diagnoses MV files that won’t play properly. Using a hex editor, Chapman discovers that the MV files were actually renamed OGG files, which is another popular audio format. He also learned that the data that designated the file type, “OGGS,” in this case, wasn’t present in the broken files. He used a hex editor to insert the appropriate data and the files played properly.
Reverse-Engineer Old or Unknown Files
Programs and games often use their own file type that an in-program (or in-game) engine decompiles and uses. However, if the original program is not available (or doesn’t exist), you won’t be able to open the file unless you have a hex editor.
Since hex editors show you the raw data of a file, not the interpretation of that data, hex editors can open absolutely any type of file, allowing you to dig around and find out what they really are.
Get Rid of Invisible Data
In some cases, hex editors can help you get rid of watermarks or other data that is hidden within a file.
For example, sometimes when you copy text from HTML (such as in an email) to a text editor, the copy-paste picks up a hidden character that the email client put there. Oftentimes this is a blank character that signals to a program that it is safe to break a line. In these cases, you cannot find or edit that character unless you have a hex editor, which can show you the source of the invisible character and lets you delete it.
Hex editors are a favorite tool of game modding communities, and there are some more uses for a hex editor that are a little more fun:
- Breaking gifs (like this)
- Modding games
- Modifying game savefiles
Try UltraEdit Today
UltraEdit is so much more than just a text editor. With UltraEdit, you’ll find a tool that can handle any task you could possibly throw at it, from finding and replacing complex strings in files to cracking open a file and showing you the byte source within.
If you or your company think that UltraEdit is a good fit for you, we invite you to give it a try free for 30 days. If you buy the program after the trial and aren’t satisfied, we will give you a full refund, no questions asked.