Web NFC API Guide: Writing NDEF Payloads, Tag Types & Browser Support
Learn how modern web applications can read and write NFC tags directly from mobile browsers using the W3C Web NFC specification, NDEF records, and smart tags.
Interacting with Physical Objects Directly from the Browser
NFC (Near Field Communication) enables short-range wireless communication (~2–4 cm) operating at 13.56 MHz. With the standardization of the **Web NFC API**, web applications can now read and write lightweight NDEF (NFC Data Exchange Format) messages without requiring native Android or iOS app installations.
---
1. Browser Support & Permissions
- **Supported Environments:** Android Chrome (v89+), Chromium-based mobile browsers (Edge, Opera, Brave for Android).
- **Security Constraints:** The Web NFC API is strictly restricted to **top-level secure contexts (HTTPS)** and requires explicit user consent via permission prompts.
---
2. Anatomy of an NDEF Message
An NDEF message is a container composed of one or more **NDEF Records**. Each record specifies:
- **TNF (Type Name Format):** Defines the record structure (e.g., Well-Known, MIME media-type, URI, Absolute URI).
- **Record Type:**
- * `"url"` or `"U"`: Standard website link with protocol prefix compression.
- * `"text"` or `"T"`: Plain text memo with language code metadata (e.g., `en`).
- * `"mime"`: Custom JSON, vCard, or binary payloads.
---
3. Writing to a Tag in JavaScript
async function writeSmartTag() {
if (!("NDEFReader" in window)) {
console.warn("Web NFC is not supported in this browser.");
return;const ndef = new window.NDEFReader(); await ndef.write({ records: [ { recordType: "url", data: "https://qraftstudio.toolpool.in" }, { recordType: "text", data: "Asset ID #9824 — Studio Inventory" } ] });
console.log("Tag written successfully!"); } ```
With our NFC Studio, you can construct multi-record NDEF payloads visually, inspect the exact byte breakdown, download raw binary `.ndef` files, and test live writing with one click.
Generate Production-Ready Codes for Free
Create customizable vector exports with live mockups, error correction, and instant client-side rendering.
Related Technical Guides
The Ultimate QR Code Printing Guide: Resolution, DPI & Minimum Sizes
Avoid unreadable codes. Learn the exact DPI requirements, minimum dimensions for print materials, quiet zone rules, and why vector SVG or PDF exports are essential for commercial print.
BarcodesEAN-13 vs. UPC-A Barcodes: Global Retail Numbering & Checksum Standards
Understand the difference between North American 12-digit UPC-A and International 13-digit EAN-13 barcodes, GS1 country prefixes, and the Modulo-10 checksum calculation.