I'm getting the error as follows

Sketch uses 2952 bytes (9%) of program storage space. Maximum is 32256 bytes.
Global variables use 196 bytes (9%) of dynamic memory, leaving 1852 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\.\COM5": Access is denied.
Failed uploading: uploading error: exit status 1

The board I am using is Arduino Uno and checked the ports too. Also restarted and installed IDE again. But still not being able to deal with it. I will be happy with the help!

  • Are you sure that COM5 is your Arduino Uno? On the device manager check if you unplug Arduino Uno, COM5 goes away.
    – Fahad
    Commented Jun 25, 2023 at 9:42

1 Answer 1


In Windows (if you are using windows), There are two things may caused the problem:

  • go to device manager >> ports >> and Uninstall all ports related to Arduino (including the COM5). Then connect the arduino again and it install it again automatically.
  • Make sure that you close all "serial monitor", before uploading the sketch.
  • I did that too. I even tried with Arduino cloud web editor. But no results. Commented Jun 25, 2023 at 2:13
  • I am sure about it. I am aware of the above mentioned method. And even tried with other ports. Still the error message is same. Commented Jun 27, 2023 at 1:56
  • Jeez, I pulled my hair out for 30 minutes trying to figure this out. Turned out to be the serial monitor in the IDE. You would think the Arduino IDE would have some awareness of this conflict. Thank you for the help. Commented Apr 5 at 15:48

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