---
title: Announcing the Capacitor NFC Plugin
description: The Capacitor NFC plugin enables interaction with NFC tags and provides cross-platform support for Android, iOS, and Web.
date: 
  created: 2022-08-17
  updated: 2026-07-10
authors:
  - robingenz
categories:
  - Announcements
  - Capacitor
  - SDKs
links:
  - Capacitor NFC: sdks/capacitor/nfc.md
faq: true
sponsor:
  name: NFC21
  image: /docs/assets/images/sponsors/nfc21-logo.png
  url: https://nfc21.de/?_locale=en&utm_source=capawesome&utm_medium=referral&utm_campaign=capawesome
---

# Capacitor NFC Plugin: Read & Write NFC Tags

Want to read and write NFC tags from a Capacitor app — for access control, product authentication, inventory, or tap-to-share? The [Capacitor NFC plugin](../../sdks/capacitor/nfc.md) from Capawesome, sponsored by [NFC21](https://nfc21.de/?_locale=en){:target="_blank"}, lets you interact with Near Field Communication (NFC) tags with cross-platform support for Android, iOS, and Web. The project is available as Sponsorware on [GitHub](https://github.com/capawesome-team/capacitor-plugins){:target="_blank"}.

<!-- more -->

Let's take a quick look at the [Capacitor NFC API](../../sdks/capacitor/nfc.md#api) and how you can read and write on passive NFC tags and stickers. For this we will use the NTAG 215 from this [NFC Starter Kit](https://www.nfc-tag-shop.de/en/NFC-Starter-Kit-Medium-12-pieces/68250){:target="_blank"}.

## Installation

To install the Capacitor NFC plugin, please refer to the [Installation](../../sdks/capacitor/nfc.md/#installation) section in the plugin documentation.

## Usage

Now let's finally start and see the plugin in action.

### Read NFC tags

Reading NFC tags is quite simple:

```typescript
import { Nfc } from "@capawesome-team/capacitor-nfc";

const read = async () => {
  return new Promise((resolve) => {
    Nfc.addListener("nfcTagScanned", async (event) => {
      await Nfc.stopScanSession();
      resolve(event.nfcTag);
    });

    Nfc.startScanSession();
  });
};
```

First you have to add the `nfcTagScanned` listener. This listener is called when an NFC tag is scanned as well as when an NFC tag opens your app.
As soon as the listener is active, you can start a new scan session with [`Nfc.startScanSession(...)`](../../sdks/capacitor/nfc.md#startscansession).
During this session the operating system is looking for NFC tags.
Once you are done, end the session with [`Nfc.stopScanSession(...)`](../../sdks/capacitor/nfc.md#stopscansession).

### Write NFC tags

An NFC tag can contain different types of data in different formats such as **NDEF**. NDEF means **NFC Data Exchange Format** and defines in which format data is stored on NFC tags and in which way it can be read.

Here we create a simple NDEF text record using [`NfcUtils`](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/nfc/docs/utils/README.md){:target="_blank"}, a utility class with various helper functions:

```typescript
import { NfcUtils } from "@capawesome-team/capacitor-nfc";

const createNdefTextRecord = () => {
  const utils = new NfcUtils();
  const { record } = utils.createNdefTextRecord({
    text: "Capacitor NFC Plugin",
  });
  return record;
};
```

This record can now be written to an NFC tag.
A NFC tag may be written to at the moment it is scanned.
That means we have to add the `nfcTagScanned` listener again.

```typescript hl_lines="8"
import { Nfc } from "@capawesome-team/capacitor-nfc";

const write = async () => {
  return new Promise((resolve) => {
    const record = createNdefTextRecord();

    Nfc.addListener("nfcTagScanned", async (event) => {
      await Nfc.write({ message: { records: [record] } });
      await Nfc.stopScanSession();
      resolve();
    });

    Nfc.startScanSession();
  });
};
```

Now we can call [`Nfc.write(...)`](../../sdks/capacitor/nfc.md#write) and write the record to the NFC tag while the tag is being scanned.

### Make NFC tags read-only

It is possible to make NFC tags permanently read-only using the `makeReadOnly` method:

```typescript hl_lines="6"
import { Nfc } from "@capawesome-team/capacitor-nfc";

const makeReadOnly = async () => {
  return new Promise((resolve) => {
    Nfc.addListener("nfcTagScanned", async (event) => {
      await Nfc.makeReadOnly();
      await Nfc.stopScanSession();
      resolve();
    });

    Nfc.startScanSession();
  });
};
```

???+ warning

    This is a **one-way** operation and cannot be undone. Once an NFC tag has been made read-only, it can no longer be written to.

### Send custom commands to NFC tags

And finally, we can send custom commands to the NFC tag.
Which NFC tag supports which commands can be found in the respective specification of the tag.
The specification for NTAG 215 can be found [here](https://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf){:target="_blank"}.

???+ note

    The codes in the specifications are often in hex format, but the plugin needs them as byte array.
    The [`convertHexToBytes(...)`](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/nfc/docs/utils/README.md#converthextobytes){:target="_blank"} method can help you with this.

In the following example we read the signature of the tag:

```ts hl_lines="6 7 8 9"
import { Nfc } from "@capawesome-team/capacitor-nfc";

const readSignature = async () => {
  return new Promise((resolve) => {
    Nfc.addListener("nfcTagScanned", async (event) => {
      const { response } = await Nfc.transceive({
        techType: NfcTagTechType.NfcA,
        data: [60, 0],
      });
      await Nfc.stopScanSession();
      resolve(response);
    });

    Nfc.startScanSession();
  });
};
```

For this, we send the command (`[60, 0]`) to the tag using the [`Nfc.transceive(...)`](../../sdks/capacitor/nfc.md#transceive) method and receive the signature as a byte array.

## FAQ

### Which platforms does the Capacitor NFC plugin support?

The plugin provides cross-platform support for Android, iOS, and the Web through a single API, so you can share most of your NFC code across platforms.

### Can I write to NFC tags, or only read them?

You can do both. `Nfc.write(...)` writes NDEF records to a tag while it's being scanned, `makeReadOnly()` permanently locks a tag so it can no longer be written to, and `transceive(...)` sends custom commands to the tag.

### What data format does the plugin use to write tags?

NFC tags typically store data as **NDEF** (NFC Data Exchange Format). The plugin ships an `NfcUtils` helper class with functions like `createNdefTextRecord()` to build the records you write.

### Can I send low-level commands to an NFC tag?

Yes. Use [`transceive(...)`](../../sdks/capacitor/nfc.md#transceive) with the tag's tech type and a byte-array command. Commands in a tag's specification are often written in hex, and `convertHexToBytes(...)` converts them to the byte array the plugin expects.

## Closing Thoughts

The [Capacitor NFC plugin](../../sdks/capacitor/nfc.md) covers the full NFC workflow — reading tags, writing NDEF records, locking tags, and sending custom commands — across Android, iOS, and Web.

**Related reading:**

- [Exploring the Capacitor NFC API](./exploring-the-capacitor-nfc-api.md) — a hands-on look at the API
- [API Reference](../../sdks/capacitor/nfc.md#api) and the [Demo App](https://github.com/capawesome-team/capacitor-nfc-demo){:target="_blank"} that shows the plugin in action

**Missing a feature?** [Create a feature request](https://github.com/capawesome-team/capacitor-plugins/issues/new/choose){:target="_blank"} in our [GitHub repository](https://github.com/capawesome-team/capacitor-plugins){:target="_blank"}.

Join the Capawesome [Discord](https://discord.gg/VCXxSVjefW){:target="_blank"} server for questions and subscribe to the Capawesome [newsletter](https://capawesome.io/newsletter/){:target="_blank"} to stay updated.
