HTML Input validation pattern for GST Number

Last Reply 9 months ago By dharmendr

Posted 9 months ago

I need html input validation pattern for GST number 

<input id="Text1" type="text" pattern="" />


You are viewing reply posted by: dharmendr 9 months ago.
Posted 9 months ago Modified on 9 months ago


For checking GST Number the partern should be follow the rule.

  1. First 2 digits of the GST Number will represent State Code.
  2. Next 10 digits will be same as in the PAN number of the taxpayer.
    • First five will be alphabets (Upper Case)
    • Next four will be numbers
    • Last will be check code (Upper Case)
  3. 13th digit will be the number of registration that you take within a state i.e. after 9, A to Z is considered as 10 to 35 .
  4. 14th digit will be Z by default.
  5. Last would be the check code.


<input type="text" id="txtGSTIN" pattern="^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$" title="Invalid GST Number." />
<input type="submit" value="Submit" />


For more details refer below link.