{
  "$comment": "Machine-readable companion to https://valem.run/calculators/uk/self-employed. Formula, inputs, outputs, engine-verified test vectors, cited sources and the re-runnable Valem ModelSpec behind the page.",
  "url": "https://valem.run/calculators/uk/self-employed",
  "dataUrl": "https://valem.run/calculators/uk/self-employed.json",
  "license": {
    "name": "CC BY 4.0",
    "url": "https://creativecommons.org/licenses/by/4.0/",
    "attribution": "United Kingdom sole trader model by Valem (https://valem.run/calculators/uk/self-employed), CC BY 4.0.",
    "note": "Covers the model — the expression of each rule and the arrangement of the catalog. The rates and thresholds themselves are law and are not licensed by anyone; the cited sources are where they come from."
  },
  "verificationUrl": "https://valem.run/calculators/uk/self-employed/verify",
  "country": "uk",
  "countryName": "United Kingdom",
  "formula": "self-employed",
  "formulaName": "Sole trader",
  "title": "Sole Trader Tax Calculator UK",
  "answer": "Your net income as a UK sole trader is profit minus income tax on everything above the personal allowance and Class 4 National Insurance at 6% between the lower and upper profits limits, then 2% above.",
  "lang": "en",
  "currency": "GBP",
  "taxYear": "2026",
  "verification": {
    "claim": "shape-only",
    "statement": "The rates in this model are illustrative. Its 3 self-test cases confirm the engine reproduces the shape of the charge, but the schedule is not the official one, so the amount will not match a real bill. The cited sources name the document that would replace it.",
    "selfTestCases": 3,
    "ratesAreIllustrative": true,
    "sourcesCheckedOn": "2026-08-22"
  },
  "sources": [
    {
      "label": "HMRC — Income Tax rates and Personal Allowances (2026/27)",
      "url": "https://www.gov.uk/income-tax-rates",
      "checked": "2026-08-22"
    },
    {
      "label": "HMRC — Self-employed National Insurance rates: Class 4 at 6% and 2% (2026/27)",
      "url": "https://www.gov.uk/self-employed-national-insurance-rates",
      "checked": "2026-08-22"
    }
  ],
  "terminalOutput": "netIncome",
  "inputs": [
    {
      "name": "annualProfit",
      "type": "number",
      "label": "Annual profit after expenses (GBP)",
      "minimum": 0
    }
  ],
  "outputs": [
    {
      "name": "personalAllowance",
      "type": "number",
      "label": "Personal allowance",
      "format": "number",
      "formula": "$round($max([0, $const.fullAllowance - $max([0, annualProfit - $const.taperThreshold]) / 2]), 2)"
    },
    {
      "name": "taxableIncome",
      "type": "number",
      "formula": "$round($max([0, annualProfit - personalAllowance]), 2)"
    },
    {
      "name": "incomeTax",
      "type": "number",
      "label": "Income tax",
      "format": "number",
      "formula": "$round($const.basicRate * $min([taxableIncome, $const.basicBand]) + $const.higherRate * $max([0, $min([taxableIncome, $const.additionalThreshold]) - $const.basicBand]) + $const.additionalRate * $max([0, taxableIncome - $const.additionalThreshold]), 2)"
    },
    {
      "name": "class4NIC",
      "type": "number",
      "label": "Class 4 National Insurance",
      "format": "number",
      "formula": "$round($const.nicMainRate * $max([0, $min([annualProfit, $const.nicUpperLimit]) - $const.nicLowerLimit]) + $const.nicUpperRate * $max([0, annualProfit - $const.nicUpperLimit]), 2)"
    },
    {
      "name": "netIncome",
      "type": "number",
      "label": "Net income / year",
      "format": "number",
      "formula": "$round($max([0, annualProfit - incomeTax - class4NIC]), 2)"
    }
  ],
  "testCases": [
    {
      "description": "50,000 GBP profit — full allowance, basic rate only",
      "given": {
        "annualProfit": 50000
      },
      "expect": {
        "personalAllowance": 12570,
        "taxableIncome": 37430,
        "incomeTax": 7486,
        "class4NIC": 2245.8,
        "netIncome": 40268.2
      }
    },
    {
      "description": "120,000 GBP profit — inside the allowance taper",
      "given": {
        "annualProfit": 120000
      },
      "expect": {
        "personalAllowance": 2570,
        "taxableIncome": 117430,
        "incomeTax": 39432,
        "class4NIC": 3656.6,
        "netIncome": 76911.4
      }
    },
    {
      "description": "150,000 GBP profit — allowance fully tapered away, into the 45% band",
      "given": {
        "annualProfit": 150000
      },
      "expect": {
        "personalAllowance": 0,
        "taxableIncome": 150000,
        "incomeTax": 53703,
        "class4NIC": 4256.6,
        "netIncome": 92040.4
      }
    }
  ],
  "spec": {
    "id": "self-employed-uk",
    "version": "1.0.0",
    "schema": {
      "type": "object",
      "properties": {
        "annualProfit": {
          "type": "number",
          "minimum": 0
        },
        "personalAllowance": {
          "type": "number",
          "readOnly": true
        },
        "taxableIncome": {
          "type": "number",
          "readOnly": true
        },
        "incomeTax": {
          "type": "number",
          "readOnly": true
        },
        "class4NIC": {
          "type": "number",
          "readOnly": true
        },
        "netIncome": {
          "type": "number",
          "readOnly": true
        }
      },
      "required": [
        "annualProfit"
      ]
    },
    "constants": {
      "fullAllowance": 12570,
      "taperThreshold": 100000,
      "basicBand": 37700,
      "additionalThreshold": 125140,
      "basicRate": 0.2,
      "higherRate": 0.4,
      "additionalRate": 0.45,
      "nicLowerLimit": 12570,
      "nicUpperLimit": 50270,
      "nicMainRate": 0.06,
      "nicUpperRate": 0.02
    },
    "defaultValues": [
      {
        "path": "$",
        "expr": "{ \"annualProfit\": 50000 }"
      }
    ],
    "derivations": [
      {
        "path": "$.personalAllowance",
        "expr": "$round($max([0, $const.fullAllowance - $max([0, annualProfit - $const.taperThreshold]) / 2]), 2)"
      },
      {
        "path": "$.taxableIncome",
        "expr": "$round($max([0, annualProfit - personalAllowance]), 2)"
      },
      {
        "path": "$.incomeTax",
        "expr": "$round($const.basicRate * $min([taxableIncome, $const.basicBand]) + $const.higherRate * $max([0, $min([taxableIncome, $const.additionalThreshold]) - $const.basicBand]) + $const.additionalRate * $max([0, taxableIncome - $const.additionalThreshold]), 2)"
      },
      {
        "path": "$.class4NIC",
        "expr": "$round($const.nicMainRate * $max([0, $min([annualProfit, $const.nicUpperLimit]) - $const.nicLowerLimit]) + $const.nicUpperRate * $max([0, annualProfit - $const.nicUpperLimit]), 2)"
      },
      {
        "path": "$.netIncome",
        "expr": "$round($max([0, annualProfit - incomeTax - class4NIC]), 2)"
      }
    ],
    "constraints": [],
    "viewDefinition": {
      "renderer": "builtin",
      "defaultView": "main",
      "views": [
        {
          "id": "main",
          "label": "Self-employed net income",
          "layout": "vertical",
          "components": [
            {
              "id": "illustrativeNotice",
              "type": "alert",
              "variant": "warning",
              "label": "What this model leaves out",
              "text": "'The 2026/27 rates and thresholds are the official ones, all frozen from 2025/26: a 12,570 GBP personal allowance, a 37,700 GBP basic-rate band, the 125,140 GBP additional-rate threshold, and Class 4 National Insurance at 6% and 2% either side of 50,270 GBP. This models a sole trader with no other income and no reliefs beyond the personal allowance: no pension contributions, no Gift Aid, no student loan repayment, no Class 2 voluntary contributions, and no Scottish rates (Scotland sets its own income-tax bands, though Class 4 is UK-wide). Enter profit after allowable expenses and capital allowances, not turnover. Not tax advice.'"
            },
            {
              "id": "profitField",
              "type": "numericField",
              "label": "Annual profit after expenses (GBP)",
              "bind": "$.annualProfit",
              "placeholder": "50000"
            },
            {
              "id": "tiles",
              "type": "group",
              "layout": "horizontal",
              "components": [
                {
                  "id": "netTile",
                  "type": "statTile",
                  "label": "Net income / year",
                  "bind": "$.netIncome",
                  "format": "number"
                },
                {
                  "id": "allowanceTile",
                  "type": "statTile",
                  "label": "Personal allowance",
                  "bind": "$.personalAllowance",
                  "format": "number"
                },
                {
                  "id": "taxTile",
                  "type": "statTile",
                  "label": "Income tax",
                  "bind": "$.incomeTax",
                  "format": "number"
                },
                {
                  "id": "nicTile",
                  "type": "statTile",
                  "label": "Class 4 National Insurance",
                  "bind": "$.class4NIC",
                  "format": "number"
                }
              ]
            },
            {
              "id": "sources",
              "type": "sourceList",
              "label": "Sources",
              "items": [
                {
                  "label": "HMRC — Income Tax rates and Personal Allowances (2026/27)",
                  "url": "https://www.gov.uk/income-tax-rates",
                  "date": "2026-08-22"
                },
                {
                  "label": "HMRC — Self-employed National Insurance rates: Class 4 at 6% and 2% (2026/27)",
                  "url": "https://www.gov.uk/self-employed-national-insurance-rates",
                  "date": "2026-08-22"
                }
              ]
            }
          ]
        }
      ]
    },
    "tests": [
      {
        "description": "50,000 GBP profit — full allowance, basic rate only",
        "given": {
          "$.annualProfit": 50000
        },
        "expect": {
          "$.personalAllowance": 12570,
          "$.taxableIncome": 37430,
          "$.incomeTax": 7486,
          "$.class4NIC": 2245.8,
          "$.netIncome": 40268.2
        }
      },
      {
        "description": "120,000 GBP profit — inside the allowance taper",
        "given": {
          "$.annualProfit": 120000
        },
        "expect": {
          "$.personalAllowance": 2570,
          "$.taxableIncome": 117430,
          "$.incomeTax": 39432,
          "$.class4NIC": 3656.6,
          "$.netIncome": 76911.4
        }
      },
      {
        "description": "150,000 GBP profit — allowance fully tapered away, into the 45% band",
        "given": {
          "$.annualProfit": 150000
        },
        "expect": {
          "$.personalAllowance": 0,
          "$.taxableIncome": 150000,
          "$.incomeTax": 53703,
          "$.class4NIC": 4256.6,
          "$.netIncome": 92040.4
        }
      }
    ]
  }
}
