Skip to content
February 28, 2008 / dranaxum

Simple Hex Editor – C#

Sometimes it’s all about having the right tool for editing. I’ve built a hex editor which can come in handy for many of those users who want to edit files (especially the binary ones). It can also be used in your program because I added the argument option.

It’s written in C# with .NET 2.0

– View file in hex
– Edit at provided offset (hex or int) – to provide a hex number please insert H in the front of the number, for example: 2D will be H2D
– Find specified string (use 0 to specify a null character)
– Edit from command line : hexeditor.exe path offset value , for example: hexeditor.exe “c:test.exe” H23 test


Source code:
Binary file:
.NET Framework:…displaylang=en



Leave a Comment
  1. Mario / Nov 27 2008 12:59 am

    To prevent a nasty crash, you might want to add this …

    private void OpenFile_Click(object sender, EventArgs e)
    path = txtFileName.Text;

    if (path.Length == 0)
    MessageBox.Show(“Please enter a file name!”);

    if ( !File.Exists(path) )
    MessageBox.Show(“No such file!”);

  2. Mario / Nov 27 2008 1:01 am

    I failed to mention that the fix above is for the case when you select the open button with an invalid (or no) file entry.

  3. dranaxum / Dec 2 2008 12:51 pm

    Mario, thanks for the feedback.
    I knew I didn’t deal with that problem the minute I published the it on this blog. The fact is that I wanted to stick to the idea and not very much on the actual code. Anyway it’s not a very big problem/bug! 🙂

  4. Nadine / Jan 22 2009 4:40 pm

    Hi there,
    Thanks for sharing this master piece with us all:

    Good Luck

  5. prajwalan / Mar 24 2009 12:51 pm

    A very cool sample.

    Keep it up.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: