CoAP Message Utility

CoAP Message Decoder

Decode raw CoAP message bytes and inspect version, message type, token length, request or response code, message ID, token, delta-encoded options, Uri-Path, Content-Format, Observe, Block1, Block2 and payload.

✓ CON / NON / ACK / RST ✓ GET / POST / PUT / DELETE ✓ Response Codes ✓ Options ✓ Blockwise ✓ Payload
CoAP
CoAP Message Decode
● Ready
Enter one complete CoAP message beginning with its four-byte header. Spaces, commas, colons, hyphens, line breaks, continuous hex and 0x-prefixed values are accepted.
CoAP base header: byte 0 contains Version, Type and Token Length; byte 1 is the request/response Code; bytes 2–3 form the Message ID. The token follows, then options encoded with cumulative option numbers. If a payload exists, byte FF separates options from the payload.
CoAP Decode Result Message Decoded
Decoded CoAP Message
Version
Message Type
Token Length
Code
Code Meaning
Message ID
Token
Options
URI Path
Content Format
Payload Length
Total Message Size
Options
Payload
Header Breakdown
Validation

What Is a CoAP Message?

CoAP, the Constrained Application Protocol, is a compact application protocol designed for constrained devices and networks. Its message format uses a small four-byte base header followed by an optional token, options and payload.

CoAP is commonly associated with IoT devices, low-power networks, embedded systems and REST-like machine-to-machine communication.

CoAP Four-Byte Header

Byte 0: Version | Type | Token Length Byte 1: Code Bytes 2–3: Message ID

CoAP Message Types

Type Value Meaning
CON0Confirmable
NON1Non-confirmable
ACK2Acknowledgement
RST3Reset

CoAP Request Codes

Code Method
0.01GET
0.02POST
0.03PUT
0.04DELETE

CoAP Response Codes

The high three bits of the Code byte form the class while the low five bits form the detail value. A response code such as 2.05 therefore represents class 2 with detail 5.

Code Byte = 0x45 Binary: 010 00101 Class: 2 Detail: 5 Result: 2.05 Content

CoAP Token

The token correlates requests and responses independently of the Message ID. Its length is encoded in the low four bits of the first header byte.

The common base CoAP format allows token lengths from zero through eight bytes.

CoAP Options

CoAP options use a compact delta encoding. Each option header stores a delta from the previous option number rather than repeating the full option number. Option length uses a similar compact representation.

Option Header: High nibble: Option Delta Low nibble: Option Length Option Number = Previous Number + Delta

Common CoAP Options

Number Option
1If-Match
3Uri-Host
4ETag
6Observe
7Uri-Port
8Location-Path
11Uri-Path
12Content-Format
14Max-Age
15Uri-Query
17Accept
20Location-Query
23Block2
27Block1
28Size2
35Proxy-Uri
39Proxy-Scheme
60Size1

CoAP Payload Marker

When a payload follows the option list, the single byte 0xFF separates options from payload data.

Options ... FF Payload bytes

A payload marker without any following payload byte is malformed.

CoAP Block1 and Block2

Blockwise transfer options divide larger representations into smaller blocks. The option value encodes block number, the More flag and block-size exponent.

Block Value: NUM = value >> 4 M = (value >> 3) & 1 SZX = value & 7 Block Size = 2^(SZX + 4)

CoAP Message Decoder FAQs

How large is the basic CoAP header?
The base CoAP message header is four bytes before the token, options and optional payload.
What does CoAP code 0.01 mean?
0.01 identifies the GET request method.
What does CoAP response 2.05 mean?
2.05 is the successful Content response code.
What does 0xFF mean in a CoAP message?
0xFF is the payload marker separating the final option from payload bytes.
How is Uri-Path represented?
Each path segment is normally encoded as a separate Uri-Path option, and the segments can be joined with slash characters to reconstruct the URI path.
What is the difference between Message ID and Token?
Message ID supports message-layer duplicate detection and acknowledgements, while the token correlates a request with its response.
Scroll to Top