Turn any file into an unsigned char array for C or C++, like xxd -i
Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 17 Oct 2026.Embedding a font, an icon or a certificate in firmware or a C++ program needs the bytes as an array. Open the file and copy unsigned char name[] = { 0x89, 0x50, ... } with the matching name_len line, exactly as xxd -i writes it, named after the file. Choose how many bytes go on each line, and capital hex digits if your style guide wants them.
Paste or type your input.
Choose the options you need.
Press Ctrl+Enter, then copy or download.
Some questions can only be answered by looking at the bytes: is there a byte order mark at the start, which line ending does this file use, is this really a PNG, why does a string compare unequal. The xxd command answers them on Linux and macOS; this page gives the same answer in a browser, on any device, with nothing installed.
| Layout | xxd option | Use it for |
|---|---|---|
| Hex | (default), -c, -g, -u | Reading and comparing files |
| Bits | -b | Checking flags and bit fields |
| Plain hex | -p | Pasting bytes into another tool |
| C array | -i | Embedding a file in C or C++ source |
Hex to file. The reverse direction reads an xxd dump with its address column, or plain hex digits with spaces, 0x prefixes, \x escapes or commas, and gives the bytes back as a download. Addresses are respected, so a dump with gaps rebuilds with zero bytes in the gaps, as xxd -r does.
The rest of the article, and all 6 questions about Hex Viewer (xxd online), are on the Hex Viewer (xxd online) page.
Open the file on this page: every byte appears as two hex digits, 16 to a line, with the offset on the left and the printable characters on the right, exactly as the xxd command prints them. Files up to 50 MB open, and nothing is uploaded, so private files are safe to inspect.
Open it and look at the first and last bytes. A UTF-8 byte order mark is ef bb bf at offset 00000000. Windows line endings show as 0d 0a at the end of each line, Unix endings as a single 0a, and old Mac files use 0d alone.
Switch to Hex to file and paste the dump. An xxd dump with addresses is read by address, like xxd -r, and plain hex digits are read in order, ignoring spaces, commas, 0x prefixes and \x escapes. Download gives the rebuilt bytes as a .bin file you can rename.
Choose the C array layout and open the file. The result is an unsigned char array named after the file, 12 bytes per line, followed by an unsigned int holding the length, the same text xxd -i writes. Paste it into a header file and include it.
Rates and rules change; check the source before you rely on a figure.
Still stuck? Ask about Hex Viewer (xxd online) and anybody who knows can answer. No account needed.
Same job, other tools: Content-Type Header – The exact Content-Type header to send, including when to add charset=utf-8.
On the related tools: Markdown to HTML – Convert Markdown into clean, safe HTML you can paste anywhere.