Tool · estimate
NDEF link size counter
A phone or USB writer stores a link on a tag as an NDEF record inside a small wrapper. This counter adds up those bytes for the link you paste and compares the total with the user memory you type from your chip's data sheet. Nothing you type leaves this page.
Bytes needed, estimate–
Paste or type a link to count its bytes.
| Part | Bytes |
|---|---|
| TLV start: tag 03 and length | 2 |
| Record header, type length, payload length, type "U" | 4 |
| Prefix code (none yet) | 1 |
| Rest of the link, UTF-8 | 0 |
| TLV terminator FE | 1 |
| Total | – |
Tag memory as written
TLV wrapperrecord header and prefix codelink text
The formula
bytes needed = rest of link (UTF-8 bytes)
+ 1 prefix code
+ 4 record header, type length, payload length, type "U"
+ 3 TLV tag 03, TLV length, terminator FE
+ 3 if the payload (prefix code + rest) is over 255 bytes
+ 2 if the whole record is over 254 bytes Example: https://example.com becomes code 04 plus 11 bytes of "example.com", so 11 + 1 + 4 + 3 = 19 bytes.
What the estimate assumes
- One link record and nothing else. Some writing apps add a second record, for example one that opens an app, which uses more bytes.
- A tag that stores the message in a TLV wrapper, as NFC Forum Type 2 tags do. Other tag types wrap the message differently, so the overhead there can differ by a few bytes.
- Only four prefixes are abbreviated here: http://www. (01), https://www. (02), http:// (03) and https:// (04). Any other link is counted in full with code 00, which is always valid but can be a few bytes longer than an app that knows more codes.
- The link is counted as typed, in UTF-8. An app that percent-encodes spaces or non-ASCII characters writes more bytes.
- Some tags keep a few bytes of their data area for lock or memory control information. Leave a small margin rather than filling memory to the last byte.
Where the numbers come from
The record layout, the short and long record formats and the prefix codes are defined by the NFC Forum in the NFC Data Exchange Format (NDEF) Technical Specification and the URI Record Type Definition Technical Specification. The TLV wrapper with tag 03 and terminator FE is defined in the NFC Forum Type 2 Tag Technical Specification. The specifications are listed on the NFC Forum specifications page. Your tag's user memory comes from its chip maker's data sheet.