> For the complete documentation index, see [llms.txt](https://help.security.gallagher.com/knowledge-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.security.gallagher.com/knowledge-hub/configuration-client/site-installation/universal-card-format/universal-card-formats-for-use-mifare-serial-number-as-card-data-csn-mode.md).

# Universal Card Formats for 'Use MIFARE Serial Number as Card Data' (CSN mode)

### Introduction

All MIFARE cards have a unique Card Serial Number (CSN) also known as a Unique ID (UID). A MIFARE card's CSN will usually be either be 4 bytes (32 bits) or 7 bytes (56 bits) in length.

Gallagher HBUS Readers and MIFARE Cardax IV Readers can be set to read the Card Serial Number (CSN) from a MIFARE Card and use it to identify a Cardholder in Command Centre. When the 'Use MIFARE Serial Number as Card Data' option is enabled on a reader, this allows the reader to send the card's CSN as Cardholder identification to the Controller if it does not detect any other form of Cardholder identification on the card. See [Creating Readers](https://help.security.gallagher.com/knowledge-hub/configuration-client/site-installation/hardware/creating-readers.md) for further detail.

In order to interpret the CSN as a card number, the Controller hosting the reader needs to be assigned a Universal Card Format (UCF) that matches the length of the CSN of the MIFARE cards being used.

### Configuring a Universal Card Format for CSN mode

Use the following procedure to create a UCF for either 4 byte (32 bit) or 7 byte (56 bit) length CSNs:

1. Click **Configure** from the menu bar, then **Universal Card Format**.

   The **Universal Card Format** List Window opens (in [grid view](https://help.security.gallagher.com/knowledge-hub/configuration-client/introduction-to-command-centre/knowing-your-way-around/list-windows/grid-view.md)).
2. Open the Universal Card Format you want to configure for CSN mode, or create a new Universal Card Format (see [Adding a new Universal Card Format](https://help.security.gallagher.com/knowledge-hub/configuration-client/site-installation/universal-card-format/adding-a-new-universal-card-format.md) for the procedure).
3. Click the **Format** tab.
4. Click the **Wiegand** radio button to indicate the required Format.
5. Depending on the length of the CSN of the MIFARE cards being used (32 or 56 bits), complete the parameters to describe the data on the cards, as indicated in the following table:

   <table><thead><tr><th width="252">Wiegand Format fields</th><th width="114">32 bits (4 byte)</th><th>56 bits (7 byte)</th></tr></thead><tbody><tr><td><strong>Number of Bits:</strong></td><td>32</td><td>56</td></tr><tr><td><strong>Bits in Facility Code:</strong></td><td>0</td><td>0</td></tr><tr><td><strong>First Bit of Facility Code:</strong></td><td>n/a</td><td>n/a</td></tr><tr><td><strong>Bits in Card Number:</strong></td><td>32</td><td>56</td></tr><tr><td><strong>First Bit of Card Number:</strong></td><td>1</td><td>1</td></tr><tr><td><strong>Bits in Issue Number:</strong></td><td>0</td><td>0</td></tr><tr><td><strong>First Bit of Issue Number:</strong></td><td>n/a</td><td>n/a</td></tr><tr><td><strong>Bits to Sum for Even Parity:</strong></td><td>0</td><td>0</td></tr><tr><td><strong>First Bit to Sum for Even Parity:</strong></td><td>n/a</td><td>n/a</td></tr><tr><td><strong>Bits to Sum for Odd Parity:</strong></td><td>0</td><td>0</td></tr><tr><td><strong>First Bit to Sum for Odd Parity:</strong></td><td>n/a</td><td>n/a</td></tr><tr><td colspan="3"><strong>Facility Code:</strong> &#x3C;select the appropriate facility code from the list></td></tr></tbody></table>

   **Note:** No bits are set for the **Facility Code** as this data is not sent when retrieving the CSN only. You will need to create a card type with the appropriate Facility Code that you want to use. On the Card Type's **Setup** property page, you also need to increase the card number **Range** to 72057594037927935 for 56 bit cards or 4294967295 for 32 bit cards. See [Setting up Card Types](https://help.security.gallagher.com/knowledge-hub/configuration-client/site-installation/card-types/setting-up-card-types.md) for further detail.
6. Select this Card Type's facility code from the **Facility Code** drop-down list.
7. Assign the UCF to the Controller's **Card Formats** property page.

### Result - using a CSN as a card number

After enabling the 'Use MIFARE Serial Number as Card Data' option (CSN mode) on the required Readers and assigning the UCF to those Reader's Controllers, you can use a MIFARE card's CSN as a card number. Note the following:

* Now when a MIFARE card, that has no Gallagher data, is presented to a reader configured for CSN mode, an 'Unauthorised Card' event is generated with details of the card's CSN displayed. You can copy this Card Serial Number to use as the card's 'Number' when you assign the card to a Cardholder.
* The **Read MIFARE Card** utility will also display a MIFARE card's CSN (in decimal format). See [Reading MIFARE Cards using a MIFARE USB Encoder](https://help.security.gallagher.com/knowledge-hub/configuration-client/site-management/cardholders/reading-mifare-cards-using-a-mifare-usb-encoder.md) for further detail. From this utility, you can copy the 'Serial Number to use as card number' and use it as the card's 'Number' when you assign the card to a Cardholder.

### Unrecognised Card Format events

If a MIFARE card without Gallagher data is presented to a reader in CSN mode and the Controller does not have the appropriate UCF assigned, then a 'Foreign Card - Unrecognised card format' event will be generated.

The details of this Foreign Card event will display the bit pattern of the MIFARE card's CSN. For example:

![](https://3000903572-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfCvaxj3suxNBzdwQndVT%2Fuploads%2Fgit-blob-8df8231f383da2218e4357a7d4baee80c975f6b2%2Fucf_csnmode_event.png?alt=media)

**Note:** T-Series readers will display an additional 2 bytes (16 bits) before the bit pattern that represents the card's CSN. For example:

Card Format: Unknown (0xF7)

Number of Bits: 72

Raw Card Data (Hexadecimal):

81 00 **80 1E 59 4A 7C 6C 04**

Raw Card Data (Binary):

10000001 00000000 **10000000 00011110 01011001**

**01001010 01111100 01101100 00000100**

The bits that represent the card's CSN (7 bytes) are highlighted in bold above.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.security.gallagher.com/knowledge-hub/configuration-client/site-installation/universal-card-format/universal-card-formats-for-use-mifare-serial-number-as-card-data-csn-mode.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
