ESP8266 - HTTPS Request

ESP8266 can act as a web client and make HTTPS requests to a web server. This web server could be a website, Web API, REST API, or Web service...


From a web client perspective, HTTPS is the same as HTTP, except that data is encrypted between the client and server. This makes HTTPS a secure protocol.

Hence, in order to understand HTTPS, we must first gain knowledge of HTTP and then discover how to encrypt data.

Learn about HTTP

  • Check out the tutorial on ESP8266 - HTTP Request at BASE_URL/tutorials/esp8266/esp8266-http-request.

Learn how to encrypt data in HTTPS

Fortunately, it is simple to alter HTTP code to create HTTPS code. Depending on the board/shield, it requires only one line of code to be modified. To do this, locate the code lines specified in the table below and substitute them with the corresponding HTTPS code.

Board/Shield HTTP Code HTTPS Code
ESP8266 UNO WIFI Rev2 client.connect(server, 80) client.connectSSL(server, 443)
ARDUINO NANO 33 IOT client.connect(server, 80) client.connectSSL(server, 443)
ARDUINO MKR WIFI 1010 client.connect(server, 80) client.connectSSL(server, 443)
ARDUINO MKR1000 WIFI client.connect(server, 80) client.connectSSL(server, 443)
ESP8266 MKR VIDOR 4000 WiFi client.connect(server, 80) client.connectSSL(server, 443)


  • For some boards/shields, if the library supports the WiFiSSLClient class, there is an additional way to modify HTTP code to make it HTTPS code. All you need to do is replace WiFiClient with WiFiSSLClient and port 80 with 443.
  • Unfortunately, ESP8266 Ethernet Shield 2 does not support HTTPS.
  • In this tutorial, we will not be providing any code. This is because you can simply get the HTTP code from ESP8266 - HTTP request and then modify it according to the instructions above. By making these modifications, you can make HTTPS POST/GET requests or send data from ESP8266 via HTTPS POST/GET to a web server.


  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!