15  NFC Tags and NDEF Format

rfid-nfc-uwb
tags
ndef

15.1 Start With the Story

An NFC tag is often treated like a tiny label, but the design problem is a record lifecycle. The tag has a family, memory size, write state, lock policy, payload format, validation rule, and fallback behavior.

Read this chapter as a release checklist for tag data. Plan the NDEF message, prove it fits, read it back, validate it before trusting it, and make clear what the tag does not authorize on its own.

In 60 Seconds

NFC tag work starts with capability and write state, not with a payload idea. Check the tag family, NDEF support, usable capacity, read/write permissions, lock or protection state, record type, parser expectations, app validation, fallback value, and read-back evidence before a tag is released.

15.2 Learning Objectives

By the end of this chapter, you should be able to:

  • Review NFC tag family fit for simple NDEF records, file-style NDEF storage, vicinity-style labels, and application-specific credential behavior.
  • Explain the relationship among tag memory, NDEF TLV containers, NDEF messages, record headers, record types, and payloads.
  • Choose URI, Text, MIME, External, or composite record patterns for a practical IoT tag workflow.
  • Validate capacity, write state, lock or protection behavior, parser output, application policy, fallback, and read-back evidence.
  • Separate public NDEF payloads from secrets, credentials, private data, and authorization decisions.

15.3 Quick Check: NFC NDEF

15.4 Minimum Viable Understanding

  • Tag type is not the payload. A tag family defines memory layout and commands; NDEF defines an interoperable payload format that may be stored on compatible tags.
  • NDEF is structured input. A message contains records; each record has header flags, type information, optional ID, and a payload that the application still needs to validate.
  • Capacity includes overhead. The usable payload must fit alongside TLV, record headers, type fields, language fields, terminator bytes, and any app-specific metadata.
  • Write success is not release evidence. Read the tag back, decode the final NDEF, validate it in the target application, test fallback, and record retest triggers.

15.5 Tag Capability Review

Use tag-family names as review hints, not as proof that a tag fits the job.

NFC tag capability review map covering tag family, NDEF support, usable capacity, write state, physical fit, validation, and release evidence.

NFC tag capability review map covering tag family, NDEF support, usable capacity, write state, physical fit, validation, and release evidence.
Tag family Confirm whether the tag is meant for simple public NDEF records, file-style NDEF storage, vicinity-style labels, or application-specific credential behavior.
NDEF support Verify the tag exposes or can be formatted with an NDEF-compatible memory layout before assuming phone interoperability.
Usable capacity Count payload plus NDEF overhead, fallback text, and any app routing data before selecting or writing the tag.
Write state Check whether the tag is blank, formatted, writable, protected, locked, or already released.
Physical fit Test the final label, mounting surface, phone orientation, case, and expected reader path.
Release evidence Keep decoded read-back output, app validation result, fallback result, owner, and retest trigger.

15.5.1 Tag-Family Prompts

Type 1 and Type 2 style tags: Good candidates for compact public NDEF payloads when capacity and write state are verified.
Type 3 style tags: Review the platform mapping and reader support before assuming the same NDEF behavior as other tag families.
Type 4 style tags: Review the NDEF file, access conditions, reader support, and application boundary separately from any credential behavior.
Type 5 style tags: Review vicinity-style read behavior, NDEF mapping, physical placement, and reader support in the target environment.

15.6 Tag Types and Discovery Path

NDEF is the data; the NFC Forum tag types are the chips that hold it, and they differ in memory, speed, and underlying technology.

Tag type Based on Typical chip or use
Type 1 (T1T) ISO 14443A Topaz; simple, small tags
Type 2 (T2T) ISO 14443A MIFARE Ultralight or NTAG21x; common low-cost labels
Type 3 (T3T) FeliCa (NFC-F) Higher-memory labels and platform-specific deployments
Type 4 (T4T) ISO 14443A/B plus ISO 7816-4 DESFire-style file systems, larger data, and secured applets
Type 5 (T5T) ISO 15693 (NFC-V) ICODE-style vicinity labels and longer-range inventory contexts

Regardless of type, a reader first discovers whether an NDEF mapping is present. On small labels this can mean reading a Capability Container or TLV-style metadata that declares NDEF memory size and access state. On file-oriented tags it can mean selecting and reading an NDEF file. That discovery step is what lets one phone handle a small NTAG poster sticker and a multi-kilobyte DESFire card with the same NDEF parsing logic.

Choosing a tag type is a memory, security, and reader-support decision. Choosing NDEF records is a behavior decision. Keep those decisions separate: a Type 2 NTAG label can be right for a public URL sticker, while a Type 4 DESFire tag can be right for a secured, file-structured credential.

Use the family names as deployment prompts, not as a simple ranking. Type 1 and Type 2 labels fit small public records such as one-time provisioning hints, read-only business-card data, URL redirects, and Bluetooth or Wi-Fi handover references when the payload is short and the lifecycle is controlled. Type 3/FeliCa belongs in a reader-support review for Japanese and wider Asian transit, e-money, membership, and ID workflows. Type 4 is the family to evaluate when a ticket, credential, or access workflow needs ISO 7816-style files, access conditions, or secured applet behavior. Type 5 maps to ISO 15693/NFC-V vicinity behavior, so library labels, product packaging, and healthcare or medication labels need placement and reader evidence before the longer coupling distance is trusted.

15.7 Quick Check: Tag Type Fit

15.8 NDEF Message Structure

NDEF turns tag bytes into records that many NFC devices can parse. It does not make the payload trustworthy by itself.

NDEF message structure showing the NDEF message container, record fields, header flags, TNF values, and common record types.

NDEF message structure showing the NDEF message container, record fields, header flags, TNF values, and common record types.
Tag memory: The physical tag stores bytes according to its family and access rules.
Container: Some tags wrap NDEF data in a TLV-style container that identifies the NDEF message and its length.
Message: An NDEF message is an ordered set of records. Message-begin and message-end flags mark the boundaries.
Record header: Header bits describe payload length format, chunking, ID presence, and Type Name Format.
Type and payload: The record type tells the parser how to interpret payload bytes. The application still validates the decoded result.

15.9 NDEF Record Planning

A tag that seems to open a URL, join Wi-Fi, or show text when you tap it is usually storing data as NDEF (NFC Data Exchange Format), the common format NFC readers understand. An NDEF message is a list of NDEF records, and each record is a typed container with a type, optional ID, and payload.

The record type is what lets a reader choose an action. A URI record says “this is a link”; a Text record says “this is text”; a MIME or External record says “this is app-specific structured data.” The tag is not running the workflow. It is presenting structured input that the phone and application decide how to handle.

NFC NDEF Message Structure: NDEF Message Container, Record 1 (MB=1), Record 2, ..., Record N (ME=1), End, NDEF Record Structure, Header, 1 byte

NFC NDEF Message Structure

For a maintenance label, a safe NDEF plan might use one URI record and one Text record. The URI record points to a controlled route such as https://ops.example.invalid/asset/PUMP-014. The Text record stores a short printed fallback such as PUMP-014, so support can compare the phone result with the visible label. The tag still does not authorize work; it only selects the asset and gives the application structured input to validate.

The release decision starts with capacity and lifecycle. If the selected Type 2 sticker has about 144 user bytes, a compact URI record plus a short fallback text record can fit comfortably. If the team later adds a JSON blob, long instructions, a signature, or multilingual fallback text, the payload can outgrow the tag even though the workflow idea is unchanged.

15.10 Record Patterns

Choose the simplest record pattern that carries the workflow safely.

URI record Opens a destination or app route. Validate scheme, host, path, schema marker, and fallback before release.
Text record Stores human-readable fallback, language-scoped labels, short instructions, or service identifiers.
MIME record Carries app-specific typed data. Validate media type, length, parser behavior, and unsupported-app handling.
External type record Names a domain-specific record type for an app ecosystem. Validate namespace ownership and versioning.
Composite record Combines records such as URI plus text. Confirm every record is needed and the final message fits.
Empty or marker record Can support provisioning or test flows, but should not be mistaken for release evidence.
ndef_record_plan: workflow: maintenance lookup label tag_family_review: compact_public_ndef records: - type: uri allowed_scheme: https allowed_host: ops.example.invalid route_pattern: /asset/{asset_id} - type: text purpose: printed_fallback_match forbidden_payload: credential unlock_command long_lived_secret private_person_data validation: decode_final_tag compare_to_plan app_accepts_valid_route app_rejects_wrong_host fallback_lookup_works

15.11 Type Name Format and Byte Budget

Each NDEF record header carries a 3-bit TNF (Type Name Format) value that tells the parser how to interpret the type field.

TNF Meaning Example
Well-Known Type NFC Forum record type definition U for URI, T for Text, Sp for Smart Poster
MIME media type Internet media type text/vcard, application/json
Absolute URI Full URI used as the record type https://example.invalid/schema
External Type Vendor-namespaced type android.com:pkg or a domain-owned app type

Header flags frame the message: MB and ME mark message begin and message end, SR marks a short record with a payload under 256 bytes, and IL signals an ID field is present. A well-formed URI record can be compact because common prefixes such as https://www. can be represented with a prefix code instead of repeated text.

Do the byte budget before writing. In a short URI record, the record overhead includes a header byte, type-length byte, payload-length byte, the one-byte type field U, and the URI payload. A short Text record is similar: it has a header byte, type length, payload length, the one-byte type field T, a status byte, language code, and text. The message may also sit inside an NDEF TLV container with its own type, length, and terminator bytes on Type 2 style tags.

For the maintenance label, the URI tail after an abbreviated https:// prefix is roughly ops.example.invalid/asset/PUMP-014, and the fallback text is only PUMP-014. That plan leaves room for normal NDEF overhead on a small public tag. A plan that adds ?user=..., a long free-text location, or a serialized access policy should be rejected or moved to the backend.

15.12 Capacity, Write State, and Locking

Capacity and write state are release criteria, not cleanup details.

Before writing Confirm tag family, NDEF support, blank or reusable state, available memory, and whether the tag has already been locked or protected.
During writing Write the planned NDEF message only from an approved source. Do not rely on copied raw bytes without decoding.
After writing Read the tag back with at least one independent reader path and compare decoded records with the approved plan.
Before locking Validate the app action, denied routes, fallback, support owner, and replacement process. Locking should follow evidence.

15.13 Validation and Security Boundary

Public NDEF is useful because it is easy to read. That also means it should not carry authority.

NFC tag and NDEF security boundary separating public payloads, application validation, forbidden data, credential systems, fallback, and audit evidence.

NFC tag and NDEF security boundary separating public payloads, application validation, forbidden data, credential systems, fallback, and audit evidence.
Public payload: A URL, text label, external type, or MIME payload can identify context or launch an app path.
Application validation: The app verifies record type, length, scheme, host, route, schema marker, asset state, user session, and denied cases.
Forbidden payload: Do not store credentials, unlock commands, long-lived secrets, private personal data, or policy decisions in readable NDEF.
Credential system: If the tap controls access or authenticity, use a credential proof path outside ordinary readable NDEF and document revocation.
Evidence: Store read-back, parser output, allowed result, denied result, fallback, owner, and retest trigger in the release record.

The same layering explains the security boundary. Type 2 and Type 5 labels are often excellent public pointers, but ordinary readable NDEF does not hide secrets from a phone. Type 4 tags can support file access conditions and larger payloads, but an NDEF file is still only one part of a credential system.

If a copied NDEF message can trigger the final action, the tag has been given too much authority. If it only opens a validated asset lookup that still checks user, device, state, and audit policy, the tag remains a replaceable pointer. When a maintenance label must prove authenticity, the NDEF record can carry a signed pointer or short token while the application verifies signature, freshness, asset state, and user policy outside the tag.

15.14 Write and Release Loop

A release loop prevents a tag from being treated as done just because a writer app returned success.

NFC tag write and release loop from payload plan through capacity check, write, read-back, app validation, field test, lock decision, and retest evidence.

NFC tag write and release loop from payload plan through capacity check, write, read-back, app validation, field test, lock decision, and retest evidence.
Plan: Define workflow, record types, allowed values, forbidden values, fallback, and release owner.
Check: Confirm tag family, NDEF support, capacity, write state, and physical placement before writing.
Write: Program the tag from the approved plan and keep the tool, batch, or writer path traceable.
Read back: Decode the final tag and compare it with the plan before locking, protecting, or installing.
Validate: Prove app acceptance, app rejection of unsafe payloads, fallback lookup, and duplicate-tap behavior.
Release: Record evidence, owner, replacement path, and retest triggers for tag, app, route, surface, or support changes.

15.15 Common Review Findings

Tag type chosen by habit. The tag must fit capacity, NDEF support, write state, placement, reader path, and support needs.
Payload too large after overhead. A payload that fits in a note may not fit once NDEF headers, language fields, type fields, and fallback data are included.
Write success trusted too early. Always read back and decode the installed tag before treating it as released.
Authority stored in NDEF. Readable records should not carry secrets, credentials, roles, unlock commands, or policy decisions.
No fallback value. A printed or text fallback keeps the workflow usable when the reader, phone setting, tag placement, or app route fails.

15.16 Check Your Understanding

15.16.1 Quick Check: Releasing an NDEF Tag

15.17 Matching Quiz: NDEF Review Artifacts

15.18 Ordering Quiz: Safe NDEF Tag Release

15.19 Summary

  • NFC tag review starts with family, NDEF support, usable capacity, write state, physical fit, and release evidence.
  • NDEF messages are structured as records with header flags, type information, optional IDs, and payloads that applications must validate.
  • URI, Text, MIME, External, and composite records are useful when each record has a clear workflow role.
  • Ordinary NDEF should carry context and routing data, not credentials, private data, unlock commands, long-lived secrets, or policy decisions.
  • A tag is not ready for release until it has been written from the approved plan, read back, decoded, validated, field-tested, and tied to fallback and retest evidence.

15.20 Key Takeaway

NFC tag and NDEF choices should be based on memory, write protection, lifecycle, reader compatibility, and the action the encoded data should trigger.

15.21 What’s Next

NFC Communication and IoT Integration Validate tap payloads in applications, gateways, policy services, and audit paths.
NFC Security and Comparisons Compare NDEF limits, credentials, relay risk, and safer proof paths.
NFC Tag Programming Build write/read-back workflows for URI, Text, MIME, and app-specific records.
NFC Apps Simulation Lab Connect tag design to practical lab evidence and rollout decisions.