How to Create .bin (binary) Files from Sketch on Arduino IDE

This guide shows how to generate a .bin (binary) file from your sketch on Arduino IDE.

Generate a .bin file in Arduino IDE

As an example, we’ll generate a .bin file from the Blink example. Follow the next steps to generate a .bin file from your sketch in Arduino IDE.

1) First,  go to Tools > Board and select the right board (for example, ESP32 DEVKIT DOIT Board).

select-board-Arduino-IDE

2) Save your sketch.

3) To generate a .bin file from your sketch, go to Sketch > Export compiled Binary

4) A new file on the folder sketch should be created. Go to Sketch > Show Sketch Folder.

5) You should have two files in your Sketch folder: the .ino and the .bin file.


Related content: ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE

We hope you’ve found this guide useful.

Thanks for reading!



Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »
Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »

Recommended Resources

Build a Home Automation System from Scratch » With Raspberry Pi, ESP8266, Arduino, and Node-RED.

Home Automation using ESP8266 eBook and video course » Build IoT and home automation projects.

Arduino Step-by-Step Projects » Build 25 Arduino projects with our course, even with no prior experience!

What to Read Next…


Enjoyed this project? Stay updated by subscribing our newsletter!

19 thoughts on “How to Create .bin (binary) Files from Sketch on Arduino IDE”

  1. Thank you Sarah, for the instructions on making a .bin file.

    Now please tell me/us why we would do that?

    What advantage is there to having a .bin file?
    Possible it might load faster but so what, a few seconds more to load doesn’t seem like I want to do this.

    Thank you, I really appreciate your tutorials!

    Ralph

    Reply
      • Another application is when one has few arduini to get the same program (ex : detect tft shield; detect I2C devices; according to the presnce of I2C devices, display the sensor -might be temperature in different rooms- ; if serial is avalaible, send it to the PC…) Having the same program is not that absurd on an Arduino Mega…. if it can handle gracefully the lack of sensors+screens, and cope with the existing ones…This makes software somewhat bigger, and compiling/linking can be felt too slow to be comfortable (remains “only” uploading : theoretically, detecting avrdudes option can make this last step almost automatic)

        Reply
    • Hello Daniel, you can read what you can do with it in the comment’s above. Here’s a summary: We created this tutorial after the “ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE“: https://randomnerdtutorials.com/esp32-over-the-air-ota-programming/
      That tutorials requires you to upload a .bin file. At the time of building that tutorial we’ve also built this one to make it easier to know how to get .bin files.

      Reply
    • I had to program a remote-control module which had no bootloader (STM32).
      The bin-file was copied to a sd-card and plugged into the remotecontrol and programmed
      to the STM32 internally.

      I was very happy to find this how2 here – Thanks a lot !

      Reply
  2. Well, there is something people sometimes miss :
    can one generate an easy to read assembly file (to detect where pieces of code can be optimized, or, more likely, to get an idea of time spent servicing an IT or a time constrained part): this is rather easy with gcc (–save-temps ), of course with g++, whatever the cpu. But I feel the arduino IDE does hide this option, which may be useful when there are some time constraints (at least, to detect something cannot be done)

    Reply
  3. I am using the ESP8266 implementation of the Homie Convention and this bin can be used by the built-in OTA for easy firmware upgrades over WiFi.
    Thank you Sara for sharing this!

    Reply
  4. When creating a bin file, it is automatically named as follows: FileName.ino.esp32.bin. Is it possible to change the automatic naming to exclude or change esp32 to something other than esp32? Thank you, Florian

    Reply
  5. Is it possible to use this .bin file to update an ESP32 without using OTA? The sketch is too large to fit on an OTA partition.

    The idea is to provide the end user (with no knowledge of arduino) a .bin file and a Windows program or script that would do the update via USB.

    Is this possible and are there any examples of this kind of thing?

    Thanks for all these great tutorials!

    Reply
  6. Hello Sara and Rui

    Maybe this is off topic, just as a suggestion, can you make a tutorial for the Arduino Nano BLE 33 Sense that can run machine learning?

    Reply
  7. Rui/Sara, The Arduino IDE 2.3.3 is not storing the file in the sketch folder. It acts like it’s compiling it, but that’s it. I see no bin file in the folder, only the ino. I made mention of this in the sketch to do ESP32 OTA updates as well. Is there another way to get the bin file?

    Reply
  8. Sort of. Under build, I found a subfolder named esp32.esp32.nodemcu-32s. In that subfolder I found 4 different bin files. I chose (sketch name).ino.bin that worked (I think). The other files are
    (sketchname).ino.bootloader.bin
    (sketchname).ino.merged.bin &
    (sketchname).ino.partitions.bin
    Along with an .elf file and a .map file.
    Thank you for all your patience, I trying to get an efficient OTA going for remote temperature sensors quickly before winter freezes. Trying to merge that into old sketches along with IDEs updating, libraries going deprecated makes it confusing to an old guy who started out with vacuum tubes. Thanks again

    Reply

Leave a Comment

Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.