A web-based application for reading RFID/NFC cards using the PN532 reader module via USB serial connection.
- Auto-detect PN532 devices on available COM ports
- Display firmware version information
- Connect/disconnect functionality
- Automatic card type identification
- Support for multiple MIFARE card types:
- MIFARE Classic 1K/4K
- MIFARE Ultralight/NTAG
- MIFARE DESFire
- MIFARE Plus
- Read complete card content (blocks/pages)
- Display data in HEX and ASCII formats
- Sector-based view for MIFARE Classic cards
- Page-based view for MIFARE Ultralight cards
- Visual card data viewer with color-coded sections
- Read Card: Read and display all accessible card data
- Write Card: Write data to card (implementation in progress)
- Format Card: Format card to default values (implementation in progress)
- Scan Again: Scan for another card
- PN532 reader module connected via USB serial
- Modern web browser with Web Serial API support (Chrome, Edge, Opera)
- Python 3.x (for standalone scanning script)
-
Open the Application
- Open
index.htmlin a compatible web browser - Or host it on a local web server
- Open
-
Connect to PN532
- Click "Connect to PN532"
- Select your PN532 device from the serial port list
- The device will initialize automatically
-
Get Firmware Information (Optional)
- Click "Get Firmware Version" to display reader information
-
Read a Card
- Present a card to the reader
- Card will be detected automatically and displayed
- Card type and UID will be shown
- Click "Read Card" to view complete card content
- Data will be displayed in a structured format with:
- Sector/block numbers
- HEX data representation
- ASCII representation (printable characters only)
-
Scan Another Card
- Click "Scan Again" to clear current card and scan for a new one
The included Python script provides command-line card scanning:
# Auto-detect PN532 device
python pn532_scan.py
# Or specify COM port manually
python pn532_scan.py COM5The script will:
- Automatically find the PN532 device
- Display firmware version
- Scan for a card
- Show card UID and type
- Exit after successful read
- Organized into 16 sectors (1K) or 40 sectors (4K)
- Each sector has 4 blocks
- Each block contains 16 bytes
- Last block of each sector is the sector trailer (contains keys)
- Organized into pages
- Each page contains 4 bytes
- Standard cards have 16 pages (64 bytes total)
- The application uses default MIFARE keys (FF FF FF FF FF FF) for authentication
- Many cards use default keys, but some may have custom keys configured
- Blocks/sectors with custom keys will fail authentication and show "Authentication Failed"
- Never store sensitive data on cards without proper key management
This application requires the Web Serial API, which is supported in:
- ✅ Google Chrome 89+
- ✅ Microsoft Edge 89+
- ✅ Opera 75+
- ❌ Firefox (not supported)
- ❌ Safari (not supported)
PN532_read_card/
├── index.html # Main HTML interface
├── app.js # Application logic and PN532 communication
├── style.css # Styling
├── pn532_scan.py # Python scanning script
└── README.md # This file
- GetFirmwareVersion (0x02): Retrieve reader firmware information
- InListPassiveTarget (0x4A): Detect and identify cards
- InDataExchange (0x40): Communicate with cards (read/write)
- SAMConfiguration (0x14): Configure security access module
Card types are identified using SAK (Select Acknowledge) values:
SAK & 0x08: MIFARE ClassicSAK & 0x20: MIFARE DESFire/SmartMXSAK = 0x00: MIFARE Ultralight/NTAGSAK = 0x20: MIFARE Plus
- Ensure PN532 is properly connected via USB
- Check device drivers are installed
- Try different USB ports
- Verify baud rate is set to 115200
- Ensure card is close enough to the reader (within 1-2 cm)
- Hold card steady during read operation
- Some sectors may be password-protected (custom keys)
- Try cleaning the reader antenna
- Use a supported browser (Chrome, Edge, Opera)
- Allow serial port permissions when prompted
- Check browser console (F12) for error messages
- Custom authentication keys configuration
- Card writing functionality
- Card formatting functionality
- Support for more card types (NTAG213/215/216, etc.)
- Data export (JSON, CSV)
- Card cloning capabilities
- Multiple card management
MIT License - Feel free to use and modify as needed.
Contributions are welcome! Please feel free to submit pull requests or open issues.
This tool is for educational and legitimate purposes only. Always ensure you have permission to read/write cards. Unauthorized access to RFID/NFC cards may be illegal in your jurisdiction.