Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper toolsHex Viewer (xxd online)File to C Array

File to C Array

dev

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.

Next:
  • MIME Types Extension to MIME type and back, with magic bytes and the header to send
  • Base64 Encode & Decode Text and files to Base64 and back, with URL-safe mode and image preview

How to use File to C Array

1

Paste or type your input.

2

Choose the options you need.

3

Press Ctrl+Enter, then copy or download.

How File to C Array works

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.

Frequently asked questions

How do I view a file in hex without installing anything?

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.

How do I check whether a file has a BOM or Windows line endings?

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.

How do I turn a hex dump back into a file?

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.

How do I embed a file in C code?

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.

Sources

  • xxd(1) manual pageOptions -c, -g, -u, -b, -p, -i, -o and -r, and the output layout
  • RFC 3629, UTF-8, a transformation format of ISO 10646How typed text becomes bytes before it is dumped

Last verified 17 October 2026.

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.

More ways to use Hex Viewer (xxd online)

  • Hex Viewer (xxd online)See any file as an xxd hex dump with offsets and text, or turn a hex dump back into a file
  • Hex to File ConverterTurn a hex dump or a string of hex digits back into a downloadable binary file

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.

Related tools

All developer tools
JSON Formatter & ValidatorFormat, validate, minify and sort JSON with exact error positionsSQL FormatterFormat and beautify SQL for PostgreSQL, MySQL, SQL Server and moreMarkdown PreviewWrite Markdown and see it rendered live, with tables, task lists and codeHTML Formatter & MinifierIndent messy HTML, or minify it and see the bytes you savedCSS Beautifier & MinifierTidy a stylesheet or minify it, with the size saved shownJavaScript Beautifier & MinifierBeautify JavaScript, or minify it and see how many bytes wentXML Formatter & ValidatorIndent XML, minify it, and see the first error by line and columnMIME TypesExtension to MIME type and back, with magic bytes and the header to send
Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)