File to hex: view the bytes of any file
See the bytes of any file as a hex dump, a hex string or a C array, and find out the file's real type
Your files stay with you. Conversion happens inside the browser; no file is ever uploaded to a server.
Did this tool do the job?
Thanks, your feedback came through.
How it works
Choose a file, pick an output format and press Convert to hex. Every byte of the file is written as a two-digit hexadecimal number and the result is saved as a text file. For example, a 783-byte PNG icon becomes a 50-line hex dump; the first line starts with "00000000 89 50 4E 47 0D 0A 1A 0A … |.PNG........IHDR|" and the result line says "Actual type: PNG". If a file is named .jpg but contains a PNG, the result line also shows a warning — a common reason a file refuses to open. The file is never sent to a server; the work happens in your browser.
This tool is also known as file to hex, hex viewer online, file to hex converter, online hex dump, binary file viewer, check real file type, file signature checker.
What is Hex (hexadecimal)?
Hexadecimal is the base-16 number system written with the digits 0-9 and the letters A-F. A byte holds a value from 0 to 255, and in hex it always takes exactly two characters: 0 is 00, 255 is FF, 137 is 89. That fixed width is why file contents are shown in hex: every byte lines up in neat columns, while in decimal a byte can take one, two or three digits.
What is Hex dump?
A hex dump is a text listing of a file's bytes, line by line. Each line has three columns: the offset, which says how many bytes from the start of the file the line begins; the hex values of the bytes on that line; and the same bytes shown as readable characters where possible. Programmers, forensic analysts and people recovering damaged files read hex dumps to see what is really inside a file.
What is the difference between hex and Base64?
Both turn a binary file into text made only of letters and digits, but they serve different purposes. Hex writes each byte as two characters, so the output is twice the size of the source and every single byte can be read. Base64 writes three bytes as four characters, so it grows by only a third, but byte boundaries are no longer visible. Use hex to look inside a file and Base64 to embed a file in an email, JSON or HTML.
The first bytes tell you what a file really is
A file extension such as .pdf or .jpg is only a label, and it changes the moment someone renames the file. What identifies the content is a short sequence of bytes at the very start, called the file signature or magic number. Every PDF starts with 25 50 44 46 (%PDF), every PNG with 89 50 4E 47 and every ZIP with 50 4B 03 04 (PK). Word, Excel and EPUB files are ZIP containers underneath, so they share the ZIP signature.
When a file will not open, or a website rejects it as an unsupported format, check its signature here first. If the result line says the extension and the content disagree, renaming the file with the right extension is usually enough. If no signature is recognised and the first bytes are all 00, the file was probably damaged during download or copying.
Which output format should you choose?
The hex dump is for reading: each line starts with the byte position in the file (the offset) in hexadecimal, and the right-hand column shows the printable characters. The layout matches the Linux hexdump -C command, with one difference: hexdump collapses repeated lines into a single "*", while this tool writes every line.
If you are going to paste the hex into code or another tool, pick the format that tool expects.
- Look inside a file, find a signature or a piece of text → hex dump
- Paste into a form, bug report or chat → spaced hex
- Program input, database field, comparing with a checksum → continuous hex
- Embed a file in an Arduino sketch, firmware or C program → C array
Frequently asked questions
What is a hex viewer used for?
It shows which bytes are actually stored in a file. You can use it to see where a damaged file breaks, find the real type of a file saved with the wrong extension, or spot hidden data a program wrote into the file.
How do I find out the real type of a file?
Choose the file here and press Convert to hex. The "Actual type" in the result line comes from the signature in the first bytes, not from the extension. If the two disagree, a warning appears at the start of the line.
What do the dots in a hex dump mean?
The text column on the right only shows standard printable ASCII characters: space, letters, digits and punctuation. Every other byte, such as a line break or the UTF-8 bytes of an accented letter, is shown as a dot. The real value of each byte is always in the hex columns on the left.
Can I turn the hex back into a file?
A continuous or spaced hex string holds exactly the same bytes and can be converted back; for text files, use the reverse direction of the Text to Hex tool. The offset and text columns of a hex dump are only there for reading and have to be removed before converting back.