How to create bin file of Arduino code

Using Arduino IDE for programming the microcontroller mostly saves the file of the code in the “.ino” format because it itself uploads the code to the Arduino board. Whereas if the compiled sketch is to be uploaded by software other than Arduino IDE, we have to create a binary or hex file for it. Using the Arduino IDE for uploading the code just creates the hex or bin file but does not save the file in that format. To create the .bin file for the Arduino code we have illustrated the process in detail in this guide.

What is a .bin file and why do we need it?

The .bin file is the one of the file formats used to save the Arduino sketch compiled for the Arduino microcontroller boards. Such format is needed when we have to upload the files to the microcontroller or program the microcontroller using programming software other than Arduino IDE. Like using the ISP programmers, over the air update programmers. The .bin file can also be used to upload the Arduino code using the command prompt of the PC or using the Bossa application to the Arduino microcontroller board.

How to create .bin file of Arduino code

The process for creating the .bin file for Arduino code is quite simple and easy and for the convenience of the reader we have illustrated the whole process with the help of images.

Step 1: Before generating the .bin file for the Arduino code we have to select the Arduino board for which we have to create a binary file. For this purpose, we have to click on the tools option in the top menu bar of the Arduino IDE and you will see the board option. To illustrate further we have provided the image below

Step 2: As you can see from the image above an extension of the menu is opened to select the board you have to click on the Arduino AVR boards and a list of boards will open. Since the board we are using is the Arduino Uno so we selected the Arduino Uno option

Step 3: After you have selected the board, compile your sketch to see if there are any errors. Once the code is compiled successfully click on the option of sketch in the menu bar at the top of the Arduino IDE

Step 4: by clicking on the sketch another list of options will pop up and you will see the option of Export Compiled Binary in the sketch menu. To create the binary of the Arduino sketch, select the Export Compiled binary option and your code will compile and create its .bin file.

You can also use shortcut keys “Alt+Ctrl+S”.

Step 5: Once the .bin file of the Arduino code is created you can excess it by selecting the option of show sketch folder in the sketch menu; the folder in which the .bin file is saved will be opened.

In the image above you can see the file highlighted in red is the .bin file of the Arduino sketch that is generated using the export to binary option in the Arduino IDE.


Saving Arduino code with the .bin format comes in handy when the software other than Arduino IDE is to be used for programing the Arduino microcontroller board. Mostly the bin file is uploaded to the Arduino boards using the ISP programmer or by OTA programmer for IOT applications. We can also use the command prompt or the Bossa application for uploading the bin file to the Arduino boards. To create the bin file of the Arduino sketch we have described its process in detail along with supporting images in this guide.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.