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.
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 Turnover | HSN/SAC Digits Required |
|---|---|
| Up to ₹5 Crore | 4 digits (optional in invoices) |
| ₹5 Crore to ₹5000 Crore | 4 digits mandatory |
| Above ₹5000 Crore | 6 digits mandatory |
Why Extract HSN Codes from GST JSON?
Extracting HSN codes from GSTR-1 and GSTR-2B JSON files helps you:
- Create HSN-wise summaries for tax analysis
- Verify HSN accuracy across all invoices
- Prepare HSN summary for GSTR-1 filing
- Analyze product-wise sales and purchases
- Check GST rate consistency for each HSN
- Audit compliance with HSN reporting rules
- 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:
- Upload your GSTR-1 or GSTR-2B JSON file
- Automatic extraction of all HSN/SAC codes
- Download Excel file with HSN column included
- 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
Method 2: Manual Extraction from JSON
If you prefer manual extraction:
- Open JSON file in a text editor (Notepad++, VS Code)
- Search for “hsn_sc” to find all HSN occurrences
- Copy values manually
- 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
- Upload GSTR-1 JSON to our tool
- Look for “HSN Summary” sheet in downloaded Excel
- Data includes all fields from HSN section
Manual Excel Method
- Extract invoice-level HSN data
- Use Excel Pivot Table:
- Rows: HSN Code
- Values: Sum of Taxable Value, Sum of Tax Amount
- 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
- Identify errors in Excel after extraction
- Correct in billing software or accounting system
- Re-generate JSON from GST portal
- 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
| Industry | Common HSN | Description |
|---|---|---|
| IT Services | 998314 | Software development |
| Hardware | 8471 | Computers, laptops |
| Textiles | 5208-5212 | Cotton fabrics |
| Electronics | 8517 | Mobile phones |
| Consulting | 998313 | Business consulting |
| Food | 1905 | Bakery products |
| Construction | 9954 | Construction services |
SAC Codes for Services
| Service Type | SAC Code | GST Rate |
|---|---|---|
| Legal services | 998211 | 18% |
| CA services | 998212 | 18% |
| IT consulting | 998313 | 18% |
| Advertising | 998361 | 18% |
| Freight transport | 996511 | 5%/12% |
Using HSN Extraction for GSTR-1 Filing
Step-by-Step Process
- Download GSTR-1 JSON from portal (before filing)
- Extract HSN data using our tool
- Review HSN summary in Excel
- Verify totals match invoice data
- Check digit requirements based on turnover
- Correct errors in billing software if found
- Upload corrected data to GST portal
- 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
- Download GSTR-2B JSON from GST portal
- Upload to our converter
- Get Excel with HSN column for all purchases
- 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
| Feature | Our Free Tool | Paid Software |
|---|---|---|
| Cost | Free forever | ₹500-₹2000/month |
| HSN extraction | ✅ Automatic | ✅ Automatic |
| Privacy | 100% local | Often uploads to server |
| Excel export | ✅ Included | ✅ Included |
| File size limit | 50MB | Usually 10-20MB |
| No registration | ✅ Yes | ❌ Registration required |
Tips for HSN Management
- Maintain HSN master - Keep Excel sheet with all your HSN codes
- Use consistent descriptions - Same HSN = Same description
- Update regularly - HSN rates may change with GST amendments
- Train billing team - Ensure correct HSN entry at invoice level
- Quarterly review - Check HSN accuracy every quarter
- 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.
Related Articles:
Ready to Convert Your GST JSON Files?
Try our free online converter now - no registration required!
Convert JSON to Excel →