From Documents to Capital Gains Tax Calculation
This page provides an overview of how Skatteguru transforms your uploaded documents into accurate capital gains taxes. Understanding this pipeline can help you troubleshoot issues and make informed decisions when editing your data.
Overview
The data pipeline consists of six main stages that transform your raw documents into a complete Swedish tax declaration:
- Document Upload & Classification - Files are identified and categorized
- Text Extraction & Parsing - Structured data is extracted from documents
- Financial Event Generation - Parsed data becomes standardized financial events
- User Overrides - Manual corrections for e.g. FX rates (optional)
- Processing - Events are organized and profit/loss and capital gains tax is calculated
- Capital Gains Tax Calculation - Final capital gains tax liability is produced
Visual Data Flow
Here's a visual representation of the entire pipeline from document upload to RSU file:
Document Upload & Classification
Text Extraction & Parsing
parsedData: {
metadata: { parserId, version, ... },
events: [
{ type, symbol, date, time, shares, price, fee, ... }
]
}Financial Event Generation
User Overrides
Processing
Processing Strategies:
- 1. Remove Duplicates
- 2. Add Special Events (splits/mergers)
- 3. Collapse Events
- 4. Apply FX Overrides
Average Cost Method (Genomsnittsmetoden):
- Events sorted by date/time
- avg_cost = total_cost ÷ total_shares_owned
- profit = (sale_price × shares) - (avg_cost × shares)
Tax Calculation
Tax Methods (Choose lowest):
- Standard: profit = sale_price - cost
- Schablon (20%): Always allowed for shares
K4 Form Fields:
| 3100: | Quantity |
| 3102: | Sale Price (SEK) |
| 3103: | Acquisition Cost (SEK) |
| 3104/3105: | Profit/Loss |
How the dashboard 'Capital Gains Tax' estimate is calculated
The “Capital Gains Tax (Estimated liability)” figure shown next to Gross Profit is a K4-only estimate intended to help you anticipate the impact on your residual tax.
It applies the 30% rate after taking into account the documented Swedish rule for section D:
- Net gains and losses in sections A and C are included at 100%.
- Net losses in section D are included at 70% (the normal deductibility rate).
- Net gains in section D are included at 100%.
This is still only the K4 portion. Your final capital income tax on Inkomstdeklaration 1 also depends on interest, dividends, other capital items, and any carry-forwards Skatteguru does not see. Use the per-section declaration values + SRU file for the authoritative reporting numbers, and the residual tax calculator for further refinement.
Related Articles
- Why You Need Transaction-Level Data — Why broker gains & losses summaries aren't enough for K4
- Currency Conversion Rules — How we handle exchange rates for foreign stocks
- Same-Day Stock Sales — Why execution time matters for same-day transactions
- How We Process Your Documents — Details on our document parsing pipeline

We're Here to Help
Have questions or feedback? We'd love to hear from you. Get in touch.