Note: Hex editing is considered an advanced feature of NSMB Editor. Also, ALWAYS back up your level (or better: your ROM) before hex editing in case you do something wrong

Also, hex editing is now nearly useless. Now, the editor lets you edit nearly everything in a level, so there's no need to manually hex edit a level. I'll leave it here just in case. ~Dirbaio

There have been some questions lately about how to hex edit levels in New Super Mario Bros to access and edit features not yet implemented by the GUI editor. This is a tutorial on how to do that.

1)
Select your level, then hit the Hex Edit button.

2)
There are 14 "Blocks" you can edit, selectable by using the drop down box.
I've underlined most of the bits pairs of two. Most data is stored as a numeric variable that takes up 4 characters.
However, notice that I underlined a few of them as just pairs. That is because some data is stored as a numeric value that only takes two characters.
Treeki, Tanks, myself, and some other people have done extensive research on what each block does, and we reported our findings in the long stickied thread.

3)
I will explain how to edit the data using block 8, which contains the information for views. A View has several variables, as you can see in the image.

Using the information found in this post and this post, we will edit the dimensions of the view in my world 1-1.

4)
The first thing that is confusing is how to convert hex into decimal.

Decimal is called "Base 10"
This is what we use most of the time with our math. We count 10 numbers before we increment the tenth's place.
We go:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Then, we've run out of numbers, so we go:
10, 11, 12, 13, 14, 15, 16, 17, 18, 19

To convert between the two, you can do it in your head, but its tricky. The best way to do it is to use the Windows Calculator.
To convert from Dec to Hex, make sure you're in Dec mode first, then type in your number, then click Hex. It works this way vice-versa.

5)
So, lets say we want to use 6688 for our X position for our view.
We convert it into Hex, and we find that 6688 in Dec is equal to 1A20 in hex.

Before we can plug that into the editor, we need to make one minor, simple adjustment. The four digit values must be switched around by pairs of two.

We use: 1A20, which is equal to 6688.

First, break it in two two pairs: 1A 20
Then, swap their order: 20 1A.
Now, 201A is the value we have to plug into editor to use a value of 6688.

This is confusing to deal with and tricky to remember, but it gets easier.

--

Now, lets use a value of 586, which is equal to 24A. This is tricky because its only 3 digits, not 4.
So, before we can swap its order, we need to realize that 24A = 024A
Now, we can swap it: 4A02
Plug that into the editor for a value of 586.

--

Some variables are only two digits, like the ID. You do not need to swap anything here.

agreed ^__^ Okay, so I get conversions and counting now, and where things need to go in Block 8. But do you guys have a list of possible variables and what they do? For example, what are the max X, Y, H and W variables I can use, and how do I apply more than one in an area (you know how some areas have more than one gray outlined area)? and if H and W are for the camera's total height and width, what do X and Y edit?

Originally posted by m64magreed ^__^ Okay, so I get conversions and counting now, and where things need to go in Block 8. But do you guys have a list of possible variables and what they do? For example, what are the max X, Y, H and W variables I can use, and how do I apply more than one in an area (you know how some areas have more than one gray outlined area)? and if H and W are for the camera's total height and width, what do X and Y edit?

You won't want to make your level area go past 512x256 tiles, or 8192x4096 pixels - I'm not sure how the game will behave here since this is the max size for levels.

X and Y are the position of the grey outlined area (the bit you can view in-game).
If an area has more than one of them, block 8 will be bigger - notice how Garmichael's screenshot contains "30 00 B0 00 80 10 40 01 00 00 1A 00 00 00 00 01"?
That string is for the first grey outlined area. If a level has more than one, there will be multiple strings; one for each.