This is what it looks like when writing an int 0x123456 to a file viewed in hex view of notepad++. At the first glance, you cannot match it with the value 0x123456, even after reversing the digits from “563412” to “214365”. How to interpret the digits?
First, every byte in the file is shown in two hex digits(0-9,A-F).
Second, The bytes are stored in the file in the order from left to right and from top to bottom in the view, i.e., the byte 0x56 is the first byte of the file, 0x34 is the second byte of the file, 0x12 is the third byte of the file, etc. If the bytes are read from the file to memory, the bytes coming first are stored in memory of lower address so 0x56 is read to pointer p, 0x34 is read to p+1, 0x12 is read to p+2, etc. But if we consider multiple continuous bytes as one number, we have two possible interpretations about the value of the number. For example, if we consider two continuous bytes 5634 as one number and interpret it little-endian(i.e.,least significant byte at lowest memory address), the number is interpreted as 0x3456 because 56 is at lower memory address so it is the less significant byte of the number and 34 is at higher memory address so it is the more significant byte of the number. If we interpret it big-endian(i.e., most significant byte at lowest memory address), the number is interpreted as 0x5634. If we consider four continuous bytes 56341200 and interpret it little-endian, the value is 0x00123456. If we interpret the 4 bytes big-endian, the number value is 0x56341200.
In most cases, we are using little-endian. So, we must read the data in the hex view reversely. But we do not need to reverse the 2 hex digits in a byte. In other words, in a byte, the most significant bit always comes first, and the least significant bit always comes last. I do not say it is little-endian or big-endian because the definition of little-endian or big-endian need the definition of address so we can say a bit is located at some address and another bit is located at some other address, moreover the comparison between two addresses so that we can say an address is lower than another address or an address is higher than another address. Unfortunately, we usually don’t have such an address for a bit. We only have address for a byte. What I said a bit comes first or last just means that we see a bit come before another bit in paper/pronunciation/or our brain, in other words, the bit order here is just an abstract concept. You cannot know or do not need to know the real position of a bit relative to another bit in computer memory or storage media.