Introduction: How to Upload Code on ESP32 & ESP8266 Using Arduino IDE (Step-by-Step Beginner Guide)
ESP32 and ESP8266 are two of the most powerful and popular Wi-Fi-enabled microcontroller boards used in IoT, home automation, smart displays, and wireless projects. From beginners to professionals, these boards are widely preferred because they are low-cost, compact, and capable of connecting directly to the internet without any external module.
However, if you are using ESP32 or ESP8266 for the first time, you might notice that Arduino IDE does not support these boards by default. Many beginners get confused at this stage and struggle to upload their first code successfully. That’s why this tutorial is created—to make the entire process simple, clear, and beginner-friendly.
In this tutorial, you will learn how to upload code on ESP32 and ESP8266 using Arduino IDE in a proper step-by-step manner, without skipping any important detail. We will cover everything starting from installing Arduino IDE, adding ESP board support, selecting the correct board and port, and finally uploading the code without errors.
Let’s get started step by step and make your ESP board ready for programming!
Supplies
To upload code on ESP32 or ESP8266 using Arduino IDE, you will need the following basic components:
- ESP32 or ESP8266 Board
This is the main microcontroller board where the program (sketch) will be uploaded.
- ESP32 offers dual-core processing, built-in Wi-Fi and Bluetooth
- ESP8266 offers built-in Wi-Fi and is widely used for IoT projects
- Micro USB Cable (Data Cable)
A good quality Micro USB cable is required to connect the ESP32 or ESP8266 board to your computer.
- Make sure it is a data cable, not a charge-only cable
- This cable is used for uploading code and powering the board
These two components are enough to upload and test your first program on ESP32 or ESP8266 using Arduino IDE.
Step 1: Understanding ESP32 and ESP8266 Modules
Arduino IDE does not come pre-installed with ESP32 or ESP8266 board support. So before learning how to upload code to these boards, it is important to understand what these modules are and why they are so powerful.
🔷 ESP32 Module
ESP32 is a highly advanced microcontroller module designed for IoT and wireless applications. It comes with built-in Wi-Fi and Bluetooth, which allows it to connect directly to the internet without using any external network module.
Most commonly used ESP32 development boards come with 30 pins, which include:
- Digital GPIO Pins – Used to connect LEDs, relays, sensors, displays, etc.
- Analog Input Pins (ADC) – Used to read analog sensor values like temperature, gas, or light sensors
- PWM Pins – Used for motor control, LED brightness control, and buzzer output
- UART Pins (TX, RX) – Used for serial communication and debugging
- SPI Pins – Used to connect high-speed devices like displays and SD cards
- I2C Pins (SDA, SCL) – Used to connect sensors and modules using I2C protocol
- Power Pins (3.3V, VIN, GND) – Used to power external components
ESP32 operates on 3.3V logic level, is faster than Arduino boards, and supports multitasking due to its dual-core processor. Because of its high performance and wireless capability, ESP32 is widely used in smart home systems, IoT dashboards, wireless clocks, and automation projects.
🔷 ESP8266 Module (Brief Overview)
Just like ESP32, ESP8266 is also a popular Wi-Fi microcontroller module used for IoT projects. It comes with built-in Wi-Fi, but compared to ESP32, it has fewer pins and no Bluetooth support.
ESP8266 is:
- Smaller in size
- Lower in cost
- Easy to use for simple IoT applications
It is commonly used in NodeMCU and ESP-12 boards and is perfect for projects like Wi-Fi switches, online data logging, and basic internet-connected devices.
Step 2: Adding ESP32 / ESP8266 Board Support in Arduino IDE
To upload code on ESP32, first connect the Micro USB cable to the ESP32 board and the USB end to your laptop or computer. Once connected properly, the red power LED on the ESP32 will start glowing, which indicates that the board is powered ON.
Now open the Arduino IDE software on your system.
NOTE: Make sure your system is connected to the internet, because we need to download board files in the next steps.
⚠️ Why This Step Is Important
When you go to Tools → Board, you will notice that ESP32 and ESP8266 boards are not available by default in Arduino IDE. That’s why we need to manually add support for these boards.
Adding ESP Board Support
- Click on File → Preferences in Arduino IDE
- A new Preferences window will open
- Find the field named “Additional Boards Manager URLs”
- Copy and paste the given link 👉( https://dl.espressif.com/dl/package_esp32_index.json )
- Click OK to save the settings
(This link tells Arduino IDE where to download ESP32 and ESP8266 board packages from.)
Installing ESP32 Board Package
- Now go to Tools → Board → Boards Manager
- A new Boards Manager window will pop up
- In the search bar, type ESP32
- Select ESP32 by Espressif Systems
- Choose the latest version
- Click on Install
Within a few seconds, the ESP32 board package will be downloaded and installed successfully.
Step 3: Selecting ESP32 Board and Uploading Code
Now our ESP32 board package has been installed successfully in Arduino IDE.
Next, we need to select the correct board before uploading the code.
Selecting the ESP32 Board
- Go to Tools → Board
- Scroll down and you will find ESP32 Arduino boards
- From the list, select the board type according to your ESP32
👉 In my case, I am using ESP32 DEV Module, so I will select ESP32 Dev Module.
Once the board is selected correctly, Arduino IDE is now ready to upload the code.
Uploading the Code
- Click on the Upload button in Arduino IDE
- Arduino IDE will start compiling the code
- While uploading, you may notice that an error appears on the screen
⚠️ Don’t worry! This error is very common while uploading code to ESP32, especially for the first time. It happens because ESP32 sometimes needs to be put into upload (boot) mode manually.
Step 4: Fixing Upload Error & Final Upload
To overcome the upload error, we need to manually put the ESP32 into upload mode.
Using the BOOT Button
- Press and hold the BOOT button on the ESP32 board
- While holding the BOOT button, click on the Upload button in Arduino IDE
- Keep pressing the BOOT button until the code starts uploading (you will see “Writing at…” in the status bar)
- Once uploading starts, release the BOOT button
Now the code will upload without facing any issue, and after completion, your ESP32 will start running the uploaded program.
🔁 Uploading Code on ESP8266
Using the same process, you can also:
- Install the ESP8266 board package from Boards Manager
- Select the correct ESP8266 board (like NodeMCU or ESP8266 Generic)
- Upload the code using Arduino IDE
This makes Arduino IDE a powerful tool to program both ESP32 and ESP8266 Wi-Fi modules easily.
Step 5: Conclusion
Such that, by following these steps, we can successfully upload code to ESP32 and ESP8266 using Arduino IDE software. This method is simple, beginner-friendly, and works perfectly for most Wi-Fi-based projects.
I hope you understood everything clearly and liked this tutorial.
💬 Let me know your comments or suggestions from your side regarding this tutorial.
Happy coding and keep building amazing IoT projects!





