GST Guide

How to Extract HSN Codes from GST JSON Files - Complete Guide 2026

Learn how to extract HSN and SAC codes from GSTR-1 and GSTR-2B JSON files, create HSN-wise summaries, and export to Excel for analysis and reporting.

GST Converter Team
#HSN #SAC #GSTR-1 #JSON #Excel

What are HSN/SAC Codes in GST?

HSN (Harmonized System of Nomenclature) codes are used for classifying goods, while SAC (Services Accounting Code) codes classify services under GST. These codes are mandatory in invoices and GST returns based on turnover thresholds.

HSN/SAC Reporting Requirements

Annual TurnoverHSN/SAC Digits Required
Up to ₹5 Crore4 digits (optional in invoices)
₹5 Crore to ₹5000 Crore4 digits mandatory
Above ₹5000 Crore6 digits mandatory

Why Extract HSN Codes from GST JSON?

Extracting HSN codes from GSTR-1 and GSTR-2B JSON files helps you:

  1. Create HSN-wise summaries for tax analysis
  2. Verify HSN accuracy across all invoices
  3. Prepare HSN summary for GSTR-1 filing
  4. Analyze product-wise sales and purchases
  5. Check GST rate consistency for each HSN
  6. Audit compliance with HSN reporting rules
  7. Export to Excel for custom reports

Where HSN Data Exists in GST JSON Files

GSTR-1 JSON - HSN Section

GSTR-1 files contain a dedicated HSN summary section:

"hsn": {
  "data": [
    {
      "num": 1,
      "hsn_sc": "8471",
      "desc": "Computers and peripherals",
      "uqc": "NOS",
      "qty": 100,
      "val": 590000,
      "txval": 500000,
      "iamt": 0,
      "camt": 45000,
      "samt": 45000,
      "csamt": 0
    }
  ]
}

GSTR-1 JSON - Invoice Level HSN

HSN codes also appear in individual invoices (B2B, B2CL):

"itms": [
  {
    "num": 1,
    "itm_det": {
      "hsn_sc": "8471",
      "rt": 18,
      "txval": 50000,
      ...
    }
  }
]

GSTR-2B JSON - Purchase HSN

GSTR-2B contains HSN in purchase invoices:

"itms": [
  {
    "num": 1,
    "itm_det": {
      "hsn_sc": "8471",
      "rt": 18,
      "txval": 30000,
      ...
    }
  }
]

How to Extract HSN Codes from GST JSON Files

Method 1: Use Free Online Converter (Easiest)

Our GST JSON to Excel converter automatically extracts HSN codes:

  1. Upload your GSTR-1 or GSTR-2B JSON file
  2. Automatic extraction of all HSN/SAC codes
  3. Download Excel file with HSN column included
  4. Filter and analyze HSN-wise data in Excel

The Excel output includes:

  • Invoice number
  • Date
  • Customer/Supplier GSTIN
  • HSN/SAC code
  • Description
  • Quantity and UQC
  • Taxable value
  • GST rate
  • Tax amounts

Extract HSN codes now →

Method 2: Manual Extraction from JSON

If you prefer manual extraction:

  1. Open JSON file in a text editor (Notepad++, VS Code)
  2. Search for “hsn_sc” to find all HSN occurrences
  3. Copy values manually
  4. Create Excel sheet and paste data

Drawback: Extremely time-consuming for files with hundreds of invoices.

Method 3: Python Script

For developers, here’s a Python script to extract HSN codes:

import json
import pandas as pd

# Load GSTR-1 JSON
with open('gstr1.json', 'r') as f:
    data = json.load(f)

hsn_list = []

# Extract from HSN summary
if 'hsn' in data and 'data' in data['hsn']:
    for hsn in data['hsn']['data']:
        hsn_list.append({
            'HSN': hsn.get('hsn_sc'),
            'Description': hsn.get('desc'),
            'UQC': hsn.get('uqc'),
            'Quantity': hsn.get('qty'),
            'Taxable Value': hsn.get('txval'),
            'Total Tax': hsn.get('iamt', 0) + hsn.get('camt', 0) + hsn.get('samt', 0)
        })

# Convert to DataFrame and Excel
df = pd.DataFrame(hsn_list)
df.to_excel('hsn_extract.xlsx', index=False)

Requirement: Python installation and pandas library.

Creating HSN-Wise Summary from JSON Data

What is HSN Summary?

HSN summary aggregates all outward supplies by HSN code, showing:

  • Total quantity sold per HSN
  • Total taxable value per HSN
  • Total tax collected per HSN
  • UQC (Unit Quantity Code)

Extracting HSN Summary from GSTR-1

GSTR-1 JSON already contains HSN summary in the hsn.data section. To extract:

Using Our Converter

  1. Upload GSTR-1 JSON to our tool
  2. Look for “HSN Summary” sheet in downloaded Excel
  3. Data includes all fields from HSN section

Manual Excel Method

  1. Extract invoice-level HSN data
  2. Use Excel Pivot Table:
    • Rows: HSN Code
    • Values: Sum of Taxable Value, Sum of Tax Amount
  3. Create summary report

HSN Code Validation and Common Issues

Invalid HSN Codes

Common HSN errors in JSON files:

Wrong digit count

  • Found: “847” (3 digits)
  • Required: “8471” (4 digits minimum)

Non-numeric characters

  • Found: “8471A”
  • Required: Only numbers

Missing HSN

  • Found: Blank or null
  • Required: Valid HSN based on turnover

How to Fix HSN Errors

  1. Identify errors in Excel after extraction
  2. Correct in billing software or accounting system
  3. Re-generate JSON from GST portal
  4. Validate again using our converter

Analyzing HSN Data in Excel

Once you’ve extracted HSN codes to Excel, you can:

1. HSN-Wise Sales Analysis

Create pivot table:

  • Rows: HSN Code, Description
  • Values: Sum of Taxable Value, Count of Invoices
  • Purpose: Identify top-selling products

2. GST Rate Verification

Filter by HSN and check if GST rate is consistent:

  • All invoices with HSN 8471 should have same rate (18%)
  • Identify rate mismatches

3. Quantity Analysis

Track quantity movement:

  • Total units sold per HSN
  • Average selling price per unit
  • Month-over-month trends

4. Compliance Check

Ensure:

  • All HSN codes have minimum required digits
  • Descriptions match HSN classification
  • No duplicate or conflicting entries

HSN Codes for Different Industries

Common HSN Codes by Sector

IndustryCommon HSNDescription
IT Services998314Software development
Hardware8471Computers, laptops
Textiles5208-5212Cotton fabrics
Electronics8517Mobile phones
Consulting998313Business consulting
Food1905Bakery products
Construction9954Construction services

SAC Codes for Services

Service TypeSAC CodeGST Rate
Legal services99821118%
CA services99821218%
IT consulting99831318%
Advertising99836118%
Freight transport9965115%/12%

Using HSN Extraction for GSTR-1 Filing

Step-by-Step Process

  1. Download GSTR-1 JSON from portal (before filing)
  2. Extract HSN data using our tool
  3. Review HSN summary in Excel
  4. Verify totals match invoice data
  5. Check digit requirements based on turnover
  6. Correct errors in billing software if found
  7. Upload corrected data to GST portal
  8. File GSTR-1 with accurate HSN summary

Common HSN Summary Errors in GSTR-1

Mismatch between invoice HSN and summary

  • Invoice shows HSN 8471, summary missing or different

Incorrect totals

  • Sum of invoice values ≠ HSN summary total value

Missing HSN section

  • Required for taxpayers above ₹1.5 crore turnover

Wrong UQC

  • Used “KGS” for services (should be NA or OTH)

Extracting HSN from GSTR-2B for ITC Analysis

Why Extract Purchase HSN?

Analyzing HSN in GSTR-2B helps:

  • Verify ITC claimed per product category
  • Match purchase HSN with sales HSN
  • Identify input-output ratio by HSN
  • Detect supplier HSN errors

Steps to Extract

  1. Download GSTR-2B JSON from GST portal
  2. Upload to our converter
  3. Get Excel with HSN column for all purchases
  4. Create HSN-wise ITC summary:
    • Pivot by HSN
    • Sum IGST, CGST, SGST

Cross-Matching HSN (GSTR-1 vs GSTR-2B)

Use Excel VLOOKUP to match:

  • Sales HSN (from GSTR-1)
  • Purchase HSN (from GSTR-2B)
  • Identify finished goods vs raw materials

Free vs Paid HSN Extraction Tools

FeatureOur Free ToolPaid Software
CostFree forever₹500-₹2000/month
HSN extraction✅ Automatic✅ Automatic
Privacy100% localOften uploads to server
Excel export✅ Included✅ Included
File size limit50MBUsually 10-20MB
No registration✅ Yes❌ Registration required

Tips for HSN Management

  1. Maintain HSN master - Keep Excel sheet with all your HSN codes
  2. Use consistent descriptions - Same HSN = Same description
  3. Update regularly - HSN rates may change with GST amendments
  4. Train billing team - Ensure correct HSN entry at invoice level
  5. Quarterly review - Check HSN accuracy every quarter
  6. Backup JSON files - Keep all historical JSON for reference

Frequently Asked Questions

Can I extract HSN codes from multiple JSON files at once?

Our current tool processes one file at a time. For bulk processing, convert each file individually and then merge Excel files using “Consolidate” feature.

What if HSN section is missing in GSTR-1 JSON?

This may happen if:

  • Return not yet filed
  • Turnover below threshold (₹1.5 crore)
  • No outward supplies in that period

You can still extract HSN from individual invoice items.

How do I handle 6-digit vs 4-digit HSN?

If your turnover is below ₹5000 crore, you can use 4 digits. Our converter displays whatever is in the JSON. You can truncate in Excel using formula: =LEFT(A2,4)

Can I add HSN codes if missing in JSON?

You cannot modify JSON. If HSN is missing, update your billing software and regenerate invoices, then download fresh JSON from portal.

Does the tool extract SAC codes too?

Yes! SAC codes for services are extracted the same way as HSN codes. They appear in the same column.

Conclusion

Extracting HSN codes from GST JSON files is essential for:

  • ✅ Accurate GSTR-1 filing with HSN summary
  • ✅ Product-wise sales and purchase analysis
  • ✅ ITC reconciliation by HSN category
  • ✅ Compliance with GST HSN reporting rules
  • ✅ Better tax planning and forecasting

Easiest Method: Use our free GST JSON to Excel converter to automatically extract HSN codes, create summaries, and get ready-to-use Excel files in seconds.

Extract HSN codes now →


Related Articles:

Ready to Convert Your GST JSON Files?

Try our free online converter now - no registration required!

Convert JSON to Excel →