ToolWren logo ToolWren
ToolWrenTokens › CoAP

CoAP Message Decoder

Paste a CoAP packet as hex bytes to break it down into its header fields, token, options and payload. Useful for IoT debugging and learning the Constrained Application Protocol (RFC 7252).

100% client-side · nothing is uploaded

Loading tool…

Quick answer

CoAP is a free, private online tool that lets you decode a CoAP binary message from hex: header, type, code, message ID, token, options and payload. It runs entirely in your browser, so nothing you enter is uploaded to a server.

How to use the CoAP

  1. Paste your CoAP message as hexadecimal bytes (spaces and 0x are ignored).
  2. Click Load sample first if you want to see an example decoded.
  3. Read the parsed header, token, options and payload in the panels below.
  4. Fix the hex if you see an error message describing what went wrong.

Privacy: this tool runs entirely in your browser. Your input is never sent to, received by, or stored on any server — there are no uploads and no tracking of what you enter.

About CoAP

What is CoAP?

The Constrained Application Protocol (CoAP) is a lightweight, RESTful protocol defined in RFC 7252 for constrained devices and networks (IoT). It runs over UDP and mirrors HTTP concepts — GET, POST, PUT, DELETE and response codes — with very low overhead.

The CoAP message format

Every message starts with a fixed 4-byte header: a 2-bit Version, 2-bit Type (CON, NON, ACK, RST), 4-bit Token Length, an 8-bit Code (e.g. 0.01=GET, 2.05=Content) and a 16-bit Message ID. The header is followed by the token (0–8 bytes), then options in delta-encoded TLV format, then an optional payload preceded by the 0xFF marker.

Reading options

Options use delta encoding: each option's number is the previous number plus the 4-bit delta nibble. Nibble values 13 and 14 signal one- or two-byte extended fields. This decoder resolves common option numbers (Uri-Path, Content-Format, Observe, etc.) and renders string/uint values where appropriate.

Frequently asked questions

What input format does this accept?
Paste the raw CoAP message as hexadecimal bytes. Spaces, newlines and 0x prefixes are ignored, so 41 01 12 34 and 41011234 both work.
How do I capture CoAP hex?
You can export bytes from Wireshark (right-click the CoAP layer → Copy → as Hex Stream) or print the UDP payload from a library such as aiocoap, libcoap or node-coap.
What does code 0.01 or 2.05 mean?
CoAP codes are written class.detail. Class 0 = request method (0.01 GET, 0.02 POST, 0.03 PUT, 0.04 DELETE). Class 2 = success (2.05 Content), 4 = client error, 5 = server error.
Does it verify DTLS / decrypt secure CoAP?
No. It parses plaintext CoAP structure only. Encrypted CoAPs (DTLS/OSCORE) payloads must be decrypted first.

Understanding CoAP in depth

What CoAP is

CoAP — the Constrained Application Protocol (RFC 7252) — is a lightweight, RESTful protocol designed for the Internet of Things. It brings the familiar web model of GET, POST, PUT and DELETE to tiny, battery-powered devices and lossy, low-bandwidth networks where full HTTP would be far too heavy. It runs over UDP instead of TCP, keeping overhead to a minimum so sensors and actuators can talk efficiently.

The 4-byte header

Every CoAP message begins with a compact fixed header just four bytes long. It packs a 2-bit version, a 2-bit type (Confirmable, Non-confirmable, Acknowledgement or Reset), a 4-bit token length, an 8-bit code (the method or response status), and a 16-bit message ID used to match requests with their acknowledgements and detect duplicates.

Tokens, options and payload

After the header comes a token (0–8 bytes) that correlates a request with its response. Then come the options — CoAP's equivalent of HTTP headers (Uri-Path, Content-Format, Observe and so on) — encoded in a compact delta format where each option's number is expressed as an offset from the previous one. Finally, if present, a single 0xFF marker separates the options from the payload that follows.

How this decoder reads a message

Paste a CoAP message as hexadecimal bytes and the tool walks it field by field: it splits out the version, type, code (shown as the readable class.detail form like 0.01 for GET or 2.05 for Content), message ID and token, then decodes each delta-encoded option to its named value, and finally extracts the payload after the 0xFF marker. It is built to match the structure defined in RFC 7252.

Reading CoAP codes

CoAP codes use a class.detail notation. Class 0 is a request method (0.01 GET, 0.02 POST, 0.03 PUT, 0.04 DELETE). Class 2 means success (2.05 Content), class 4 a client error (4.04 Not Found), and class 5 a server error (5.00 Internal Server Error). The parallels with HTTP status codes are deliberate, which makes CoAP approachable for anyone who already knows the web.

Where you'll use it

This decoder is for IoT developers debugging device traffic — captured from Wireshark, or printed by libraries like libcoap, aiocoap or node-coap. It parses plaintext CoAP structure only; encrypted transports (DTLS or OSCORE) must be decrypted first. Everything happens in your browser, so device data never leaves your machine.

Related & complementary tools

More Tokens tools