security · 2025-02-17 · 6 min read

CVV, CVC, CID: the code you must never store

The three- or four-digit code proves the card is physically present. It cannot be derived from the number, cannot be validated offline, and must never be saved — even encrypted.

The code proves the card is in hand — and must never be stored.
The code proves the card is in hand — and must never be stored. — © Aukid phumsirichat · Pexels

Each network has its own name for the card security code — CVV2 (Visa), CVC2 (Mastercard), CID (American Express, four digits printed on the front), CAV2 (JCB), CVN2 (UnionPay). All serve the same purpose: evidence that whoever is paying can see the physical card, which is why it is never embossed and never stored on the magnetic stripe. Flip the card preview at the top of this page to see where each brand prints it.

How the code is generated

The issuer derives it from the PAN, the expiry date and a service code using a secret key pair (the CVK). Without those keys the value is unpredictable. The Wikipedia entry covers the cryptographic detail.

Why it cannot be validated locally

A front end can only check the length — three digits for most brands, four for Amex, as our prefix table shows. Anything that claims to 'verify' a CVV offline is guessing. Real verification happens when the issuer recomputes the code during authorization and returns a CVV match result.

Never store it

PCI DSS classifies the security code as sensitive authentication data: it must not be retained after authorization under any circumstances, even encrypted, even for recurring billing.

Practical consequences for developers:

  • Keep it in memory only for the duration of the tokenization request; never write it to logs, analytics or session storage.
  • For subscriptions, rely on a network token and the issuer's recurring-payment flags instead of re-using the code.
  • Mask the field, disable autocomplete suggestions for it, and clear it on error.

The PCI Security Standards Council publishes the exact wording in Requirement 3.

Generated with issuer keys; only its length can be checked offline.
Generated with issuer keys; only its length can be checked offline.

Keywords: CVV, CVC, CID, card security code, CVV2, card verification value, PCI DSS CVV storage

Frequently asked questions

Is CVV the same as CVC?

Functionally yes. CVV2 is Visa's name, CVC2 is Mastercard's, CID is American Express's four-digit front-of-card code.

Can a website save my CVV for next time?

No. PCI DSS forbids storing the security code after a transaction is authorized.

On this site

External references

Related articles

CVV وCVC وCID: الرمز الذي لا يجوز تخزينه أبدًا — النسخة العربية

الرمز المكوّن من ثلاث أو أربع خانات يثبت أن البطاقة حاضرة ماديًا. لا يمكن اشتقاقه من الرقم، ولا التحقق منه دون اتصال، ولا يجوز حفظه أبدًا — حتى مشفّرًا.

لكل شبكة اسمها لـرمز أمان البطاقة — CVV2 (فيزا) وCVC2 (ماستركارد) وCID (أمريكان إكسبريس، أربع خانات مطبوعة في الواجهة) وCAV2 (JCB) وCVN2 (يونيون باي). وكلها تؤدي الغرض نفسه: دليل على أن من يدفع يرى البطاقة المادية، ولهذا لا يُنقش أبدًا ولا يُخزَّن على الشريط المغناطيسي. اقلب معاينة البطاقة في أعلى هذه الصفحة لترى أين تطبعه كل علامة.

كيف يولَّد الرمز

يشتقّه المُصدِر من رقم البطاقة وتاريخ الانتهاء ورمز الخدمة باستخدام زوج مفاتيح سري (CVK). ومن دون تلك المفاتيح تكون القيمة غير قابلة للتنبؤ. مدخل ويكيبيديا يغطي التفاصيل التشفيرية.

لماذا لا يمكن التحقق منه محليًا

تستطيع الواجهة فحص الطول فقط — ثلاث خانات لمعظم العلامات وأربع لأمكس كما يبيّن جدول البادئات. وأي شيء يدّعي «التحقق» من CVV دون اتصال إنما يخمّن. التحقق الحقيقي يحدث عندما يعيد المُصدِر حساب الرمز أثناء التفويض ويعيد نتيجة المطابقة.

لا تخزّنه أبدًا

يصنّف PCI DSS رمز الأمان بيانات مصادقة حساسة: يجب ألا يُحتفظ به بعد التفويض تحت أي ظرف، حتى مشفّرًا، حتى للفوترة المتكررة.

النتائج العملية للمطوّرين:

  • أبقه في الذاكرة فقط طوال مدة طلب الترميز؛ ولا تكتبه أبدًا في السجلات أو التحليلات أو تخزين الجلسة.
  • للاشتراكات اعتمد على رمز شبكة وإشارات الدفع المتكرر لدى المُصدِر بدل إعادة استخدام الرمز.
  • أخفِ الحقل، وعطّل اقتراحات الإكمال التلقائي له، وامسحه عند الخطأ.

ينشر مجلس معايير أمن PCI الصياغة الدقيقة في المتطلب 3.

أسئلة شائعة

هل CVV هو نفسه CVC؟

وظيفيًا نعم. CVV2 اسم فيزا، وCVC2 اسم ماستركارد، وCID رمز أمريكان إكسبريس ذو الأربع خانات في واجهة البطاقة.

هل يمكن لموقع حفظ CVV للمرة القادمة؟

لا. يمنع PCI DSS تخزين رمز الأمان بعد تفويض المعاملة.

Educational content — not legal or financial advice. Open the interactive Check Digit Lab →