Skip to content

Repository files navigation

Tax Utilities

A small, growing collection of client-side tools for Indian taxes. No sign-up, no backend - every calculation runs entirely in your browser, so your financial data never leaves your device.

Built with React + Vite + TypeScript + Tailwind CSS + shadcn/ui, and deployed to GitHub Pages as a static site.

Tools

Tool What it does
Quarterly Capital Gains Reads a Zerodha or Groww tax P&L statement (.xlsx) - stocks and mutual funds - and produces an ITR-ready breakdown of STCG, Intraday and LTCG across the five advance-tax periods, with mutual funds split by asset class, plus a buy/sell turnover summary.
SBI Forex Card Rates Looks up SBI's daily forex card rates for any date, including the TT Buying rate used to convert RSU/ESPP and other foreign income to INR for tax filing.

More utilities (Advance Tax Estimator, HRA Exemption, Old vs New Regime…) are on the way - the app is structured as a platform with a sidebar so new tools slot straight in.

Which forex rate applies (and why it is nuanced)

The tool converts using SBI's TT Buying rate (TTBR), but the relevant date and the governing law differ by ITR schedule:

  • Capital gains (Schedule CG): governed by Rule 115 - use the TTBR of the last day of the month immediately preceding the transaction date.
  • Foreign assets (Schedule FA): Rule 115 does not apply; the CBDT ITR instructions require the TTBR on the relevant event / reporting date.

The app is best-effort and shows a prominent disclaimer: verify the exact date and rate for your situation and consult a professional - do not rely on any value, tip or note blindly.

How the forex-rates lookup works

There is no backend and no hosted database. A separate scraper commits an SQLite file (sbi_rates.db) to a public GitHub repo, and the browser queries it in place using sql.js-httpvfs - a WebAssembly SQLite whose virtual file system fetches only the pages a query touches via HTTP Range requests. A date lookup pulls a few kilobytes rather than the whole multi-megabyte archive. The committed database is the API.

How the capital-gains parsing works

Two brokers are supported: Zerodha (one workbook with several sheets; stocks and mutual funds auto-detected) and Groww (separate Stocks and Mutual Funds files - upload either or both). Nothing about the sheet layout is hard-coded:

  • Sections are detected by shape - a title row has a single populated cell, the header row starts with a known label (Symbol, Stock Name, Scheme Name), and everything else is data.
  • Columns (Exit Date, Buy Value, Sell Value, Profit, ...) are resolved by header text, so column order can change without breaking anything.
  • Gain buckets are derived from the section name (long → LTCG, intraday → Intraday, short → STCG); anything else becomes its own column.
  • Mutual funds are grouped by asset class. Zerodha's dated lots are joined to its Mutual Funds classification sheet by fund name to learn (asset class, term); Groww reads the asset class from the per-row Category column and the term from which of the Short/Long gain columns is populated. The tool trusts the broker's own STCG/LTCG and asset-class buckets - no tax law is re-encoded - and buyback trades are excluded.
  • The financial year is auto-detected from the sheet name, then the data, and can be overridden in the UI.

Results are shown as up to three period-by-period tables - Stocks, Mutual Funds (columns grouped per asset class) and a combined Total (only when both are present) - plus a Buy / Sell Value table ordered Stocks, each MF category, an MF subtotal, then the grand total. A Clear button resets everything.

The five ITR periods mirror the advance-tax instalment cut-offs:

Period 1: Up to 15th June
Period 2: 16th June to 15th September
Period 3: 16th September to 15th December
Period 4: 16th December to 15th March
Period 5: 16th March to 31st March

Develop

npm install
npm run dev        # Vite dev server → http://localhost:5173

Build

npm run build      # type-check + production build into dist/
npm run preview    # serve the built bundle locally

Self-check (optional)

A dev-only script runs the tax logic over a local sample.xlsx (your own broker export, kept out of git) in Node and prints the totals, so a change can be eyeballed against a known-good result:

npx tsx scripts/verify.ts

Deploy

Pushing to main triggers .github/workflows/deploy.yml, which builds the app and publishes dist/ to GitHub Pages. One-time setup:

  1. Repo Settings → Pages → Build and deployment → Source = GitHub Actions.
  2. Push to main (or run the workflow manually from the Actions tab).

The Vite base is set to "./" so assets resolve correctly on a project page (https://<user>.github.io/<repo>/) without hard-coding the repository name.

Project layout

src/
  App.tsx                     # platform shell: sidebar + routing (hash-based)
  components/
    AppSidebar.tsx            # sidebar navigation
    Overview.tsx              # landing page listing the tools
    FileDropzone.tsx          # drag & drop upload
    QuarterlyTable.tsx        # period-wise STCG/Intraday/LTCG table (Stocks, Total)
    MutualFundsTable.tsx      # period-wise MF table, columns grouped by asset class
    TurnoverTable.tsx         # buy/sell/net by category
    ui/                       # shadcn/ui primitives
  lib/
    tax/
      parser.ts               # read xlsx grid, walk sections, extract trades
      formats.ts              # per-broker detection + extractors -> Trade[]
      periods.ts              # derive the 5 ITR periods
      report.ts               # aggregate by period; buildStatementReports()
      format.ts               # INR money formatting
    forex/db.ts               # sql.js-httpvfs client for the SBI rates DB
  tools/
    registry.ts               # TOOLS array + getTool()
    quarterly-capital-gains/  # capital-gains tool
    sbi-forex-rates/          # SBI forex card rates tool
scripts/verify.ts             # dev-only self-check against a local sample.xlsx
.github/workflows/deploy.yml  # build + publish to GitHub Pages

Notes / disclaimer

  • Intraday equity is legally speculative business income, not a capital gain. It is kept in its own column (never merged into STCG) so you can report it correctly when filing.
  • These are convenience utilities, not tax advice. Always reconcile against your broker's official figures.