How to use the File to bytes tool
- Select the File field and choose a file of 1 MiB or less from your device.
- Under Byte format, pick Hexadecimal, Decimal or Binary.
- Select Read bytes. The Result box shows the byte count, a blank line and then the bytes separated by spaces.
- Select Copy, or use the Download link to save the listing as bytes.txt.
What a file to bytes listing shows
Every file is a sequence of bytes, each a number from 0 to 255. Programs give those numbers meaning: a text editor maps them to characters, an image viewer to pixels. This tool skips interpretation and prints the raw values in file order, which is what you need when a parser rejects a file and you want to see what is really in it.
The three formats show identical data in different bases. Hexadecimal uses two lowercase digits per byte, 00 to ff, and is the usual choice because each digit maps to four bits. Decimal prints 0 to 255 with no padding, which is handy for numeric array literals. Binary prints all eight bits, which helps when you are reading flags or bit fields.
Worked example: a three-byte text file
Save the two letters Hi followed by a line feed as hi.txt and read it in each format. The capital H is 72 in ASCII, which is 48 in hex and 01001000 in binary. The last byte, 0a, is the line feed. Had the file been saved with Windows line endings, you would see 0d 0a at the end and a count of 4 bytes.
Hexadecimal
3 bytes
48 69 0a
Decimal
3 bytes
72 105 10
Binary
3 bytes
01001000 01101001 00001010Recognizing file types by their first bytes
Many formats start with a fixed signature, often called magic bytes. Reading the first few values in hexadecimal tells you what a file really is, whatever its extension says.
- PNG: 89 50 4e 47 0d 0a 1a 0a
- JPEG: ff d8 ff
- PDF: 25 50 44 46 2d, the characters %PDF-
- ZIP, and formats built on it such as DOCX and JAR: 50 4b 03 04
- GZIP: 1f 8b
- UTF-8 byte order mark at the start of a text file: ef bb bf
Size limit and output format
The tool accepts one file of at most 1 MiB, which is 1,048,576 bytes. Larger files stop with the message Choose a file up to 1 MiB for the byte listing. The listing is much longer than the file itself: hex takes three characters per byte and binary takes nine, so a full-size file yields about 3 MB or 9 MB of text.
Output is one continuous line of space-separated values. There are no offsets, no fixed row width and no ASCII column, so it is a byte list and not a classic hex dump. The byte count line appears only in the Result box; the downloaded bytes.txt contains the values alone. An empty file reports 0 bytes.
Frequently asked questions
Is my file uploaded when I read its bytes?
No. The browser reads the file into memory and the page formats the bytes itself. Nothing is transmitted, so you can inspect certificates, exports or customer files without them leaving your machine.
How do I turn the output into a byte array for code?
Pick Decimal for languages that take numeric lists, then replace the spaces with commas: 72 105 10 becomes [72, 105, 10]. For hex literals, pick Hexadecimal and add the 0x prefix to each value with find and replace in your editor.
Why does my text file have more bytes than characters?
Characters outside ASCII take more than one byte in UTF-8. An accented letter such as é is two bytes, c3 a9, and most emoji are four. A byte order mark adds three bytes at the start, and Windows line endings add one byte per line.
Can I turn the byte listing back into a file?
Not with this tool; it only reads. If you need a text form that can be turned back into the original file, encode the file as Base64 instead, which has a matching decoder.