I want to obtain the .hex file from my Arduino sketch. I have followed various guides but there is no .hex file in my output folder.

How can I obtain my hex file?

Here are my preferences:

Arduino IDE preferences

This is the contents of my output folder

Output folder


2 Answers 2


Based on your setting with the URL for esp8266 package and bin file name with "...generic" I assume you want it for esp8266.

esp8266 doesn't use hex format and "Export compiled binary" creates bin. You can upload it with esptool.

For AVR boards "Export compiled binary" generates hex. You can upload it with avrdude.

  • Ah, good catch :-) Oct 22, 2018 at 12:49

Current versions of Arduino IDE

Use the menu option in the Arduino IDE:

SketchExport Compiled Binary

See post #6 from the thread How to get hex file from arduino files ?:

Well, since it was bumped it's worth mentioning there is a new way to do this added in Arduino IDE 1.6.5:

  • Sketch > Export Compiled Binary
  • If you are doing this with an example then you will be prompted to save the sketch in another location.
  • Wait until the sketch has finished compiling.
  • Sketch > Show Sketch Folder
  • The .hex file will be in the sketch folder

Here is a screenshot for OS X:

Export compiled Binary menu option

There is no need to fully compile, a simple verify will suffice. From post #10:

Reopen Arduino, and open a sketch of your choice (use the Examples->Digital->Blink if you have no other sketches). Hit the Verify button to compile the sketch. Now, navigate to the build.path folder. You should see a bunch of files including one with a .hex extension.

Older versions of Arduino IDE

If using an older version of the Arduino IDE, from post #12:

Try this if using an older version of Arduino

Taking out HEX file from Arduino in 3 simple steps

  1. Open Arduino IDE
  2. FilePreferences menu

Arduino IDE Preferences menu

Arduino IDE Preferences dialog

  1. Find "Show verbose output during " and check the "compilation" box
  2. Locate the preferences.txt file and open it
  3. Add the following line (this is the path to the directory where the hexfile will be stored):

  4. Change the following line



  5. Quit the Arduino IDE and restart it.

  6. Now when you compile, the directory specified in build.path will contain the .hex file (along with other files which can be ignored)
  • did you read my answer?
    – Juraj
    Oct 22, 2018 at 12:48
  • Yeah, I had upvoted it... but I missed the ESP bit! I need to pay more attention :-) Oct 22, 2018 at 12:51
  • Hi Greenonline, thanks for your thorough answer. Indeed it was the detail about ESP8266 spotted by Juraj that was the key to my issue, but i really appreciate your effort :)
    – toebs
    Oct 22, 2018 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.