CoAP explained in plain terms means understanding the tiny web protocol that lets a battery-powered sensor speak to the internet. The central question is how a device with almost no memory, no screen, and a battery that must last for years can still send and receive data like a website, and the answer is a protocol that copies the web’s ideas but strips them down to fit.
CoAP, short for Constrained Application Protocol, is a web transfer protocol designed for constrained devices and networks, defined in RFC 7252 in 2014. It lets small sensors and actuators exchange data using the same request-and-response pattern as the web, but over UDP instead of TCP, and with messages a fraction of the size.
The idea is simple: give tiny devices a web of their own. A temperature sensor can offer its reading at a web-like address, a controller can ask for it with a GET request, and a light can be switched on with a PUT, all in a few bytes. This article explains what CoAP is, how it works, and where it is used.
Key takeaways
- CoAP is a web-style protocol shrunk to fit tiny, battery-powered devices.
- It runs over UDP, so it is light and fast on unreliable networks.
- Requests use familiar methods: GET, POST, PUT, and DELETE.
- Devices can observe a resource and be told when it changes.
- It is built for sensors, actuators, and low-power wireless networks.
What CoAP is
CoAP is an application-layer protocol that mirrors the REST style of the web, where every piece of data is a resource with its own address, called a URI. A sensor might expose coap://sensor/temperature, and any client that knows that address can ask for the current reading, just as a browser asks a web server for a page.
The protocol was designed for constrained nodes: devices with as little as ten kilobytes of memory, running on small batteries, connected through low-power wireless networks that lose packets and offer very little bandwidth. A normal web request, with its TCP handshake and large headers, would be too heavy for such a device, so CoAP keeps its header to four bytes and its messages short.
CoAP runs over UDP, which has no connection setup and no built-in reliability, so the protocol adds its own. Messages can be confirmable, meaning the receiver must acknowledge them, or non-confirmable, meaning they are sent once and forgotten, which lets the sender choose between reliability and lightness for each message. Our guide to MQTT explains the publish-and-subscribe protocol that is often compared with CoAP, and our guide to the Internet of Things explains the world of connected devices that CoAP serves.
How CoAP works
A CoAP exchange starts with a request. A client sends a short message containing a method, a resource address, and an optional payload, and the server replies with a response code and the data, in a pattern that will feel familiar to anyone who has used the web: a GET asks for a value, a PUT sets one, a POST creates something, and a DELETE removes it.
Reliability is handled with message IDs and acknowledgements. A confirmable message carries an ID, and the receiver must answer with an acknowledgement carrying the same ID. If no acknowledgement arrives, the sender tries again after a short wait, backing off each time, which gives the protocol a simple form of reliability without the weight of a TCP connection.
Observation is one of CoAP’s most useful features. A client can ask to observe a resource, and the server then sends a new message every time the value changes, instead of the client having to ask again and again. A thermostat can watch a temperature sensor this way, receiving updates only when the reading moves.
Discovery is built in. A CoAP device can answer a request to its well-known core address with a list of the resources it offers, so that a controller can find out what a new device can do without any prior configuration, which matters when devices are installed by the dozen.
Security comes from DTLS, the datagram version of TLS, which encrypts CoAP messages and checks the identity of both sides. DTLS adds weight, so some deployments use it only for sensitive devices, while others accept plain CoAP on a private network, but the option is part of the standard.

Comparing CoAP with other IoT protocols
CoAP is one of several protocols for connected devices, and each suits a different pattern. MQTT uses publish and subscribe through a central broker, HTTP is the full web protocol, and raw UDP with custom messages is the lightest option of all, but each has its own trade-offs.
The table below sets out the main contrasts between the leading approaches.
| Aspect | CoAP | MQTT | HTTP |
|---|---|---|---|
| Pattern | Request and response | Publish and subscribe | Request and response |
| Transport | UDP | TCP | TCP |
| Message size | Very small, 4-byte header | Small, 2-byte header | Large headers |
| Works offline | Yes, device to device | No, needs a broker | No, needs a server |
| Best for | Direct device control | Many devices, one broker | Web services, gateways |
The practical result is that CoAP is the best choice when devices talk directly to each other or to a nearby gateway, MQTT wins when many devices must share data through one broker, and HTTP is used where the full web stack is already available.
Where CoAP is used
Smart buildings use CoAP for lighting, heating, and access control. A light switch, a presence sensor, and a lamp can form a small CoAP network, where the sensor tells the controller when a room is occupied and the controller switches the lamp, all without a central server.
Industrial sensors use CoAP where power and bandwidth are scarce. A vibration sensor on a machine, a meter on a pipeline, or a soil sensor in a field can run for years on a battery, waking only to send a short CoAP message when its reading changes.
Smart meters and utilities use CoAP to report consumption. A water or electricity meter can send its reading over a low-power wireless network, and the utility can also send commands back, such as a request to disconnect or reconnect a supply.
Healthcare devices use CoAP for bedside monitoring. A small sensor can report a patient’s readings to a nearby gateway, which forwards them to a hospital system, and the lightweight protocol means the device can be small, cheap, and long-lived.
Home automation uses CoAP in standards such as Thread and Matter, where devices from different makers need a common language. A door lock, a thermostat, and a hub can all speak CoAP, which is why the protocol appears inside products whose owners never hear its name.
Strengths and limits
The greatest strength of CoAP is its lightness. A four-byte header, UDP transport, and a web-style design mean a device with almost no resources can still take part in the internet of things, and a battery can last for years because so little data is sent.
It is also a strength that CoAP speaks the web’s language. Resources, URIs, and GET and PUT requests are familiar to any web developer, and a gateway can translate between CoAP and HTTP almost directly, which makes it easy to connect tiny devices to ordinary web services.
The limits are real, though. UDP means no guaranteed delivery without confirmable messages, and the protocol is less widely supported than MQTT, so fewer cloud platforms accept it directly. Security with DTLS is also heavier than plain CoAP, which forces a choice between safety and lightness on the smallest devices.
CoAP checklist
- Use confirmable messages for commands, and non-confirmable for frequent readings.
- Use observation instead of polling, to save battery and bandwidth.
- Keep payloads small, and use a compact data format.
- Use DTLS where the network is shared or the data is sensitive.
- Let devices discover resources, instead of hard-coding addresses.
- Plan for lost packets, since UDP does not guarantee delivery.
- Use a gateway to translate CoAP to HTTP for cloud services.
- Test with the real radio conditions, not just a wired bench.
- Keep firmware updatable, since devices may run for a decade.
Frequently asked questions
What is CoAP in simple terms?
CoAP is a tiny version of the web for small devices. A sensor can offer its reading at a web-like address, and another device can ask for it with a short message, just as a browser asks for a web page.
What is the difference between CoAP and MQTT?
CoAP is request and response, like the web, while MQTT is publish and subscribe through a central broker. CoAP suits devices talking directly to each other, while MQTT suits many devices sharing data through one hub.
Does CoAP use TCP or UDP?
UDP. That keeps it light and fast, since there is no connection to set up, and the protocol adds its own acknowledgements where reliability matters.
What is CoAP observation?
It is a way for a client to ask to be told when a value changes. Instead of asking the sensor again and again, the client registers once and receives a new message every time the reading moves.
Is CoAP secure?
It can be, using DTLS, the datagram version of TLS, which encrypts messages and checks identities. Plain CoAP has no security, so it should only run on a trusted network.
Where is CoAP actually used?
In smart buildings, industrial sensors, smart meters, healthcare monitors, and home automation standards such as Thread and Matter, where small devices need a light, web-style way to talk.
The bottom line
CoAP explained in one line is this: the web’s ideas, shrunk to four-byte headers and UDP, so that a sensor with almost no memory can still speak the language of the internet.
It is a quiet protocol, rarely named on a product box, but it is the reason many small devices can be cheap, long-lived, and still connected, and it bridges the gap between the world of tiny sensors and the ordinary web.
This article is general information about how CoAP works, not advice about choosing a protocol for a particular device or system.







