Tools for cgtcalculator.com (Trading 212 and Interactive Investor UK CGT calculator)

Conversion utilities for cgtcalculator.com


For Trading 212 


NEW! - You can use my browser-based Trading 212 converter here which I have placed on a web page on my easy2boot.xyz website. No trade data will leave your system.

OR - 

use this Windows app - Download_T212_Convert_v11.6.zip - Run from Windows by double-clicking on the extracted .exe file (zip contains .exe + .py source code). Accepts multiple csv files inc. stock splits. Alternate download source: OneDrive.

NEW website!
- UK CG Tax Calculator -  This new online browser-based CGT calculator should produce very similar results to cgtcalculator.com but it also can report dividends and include ERI - see the Links section below for more details. If you have multiple brokers, it will combine the trades if you select all the CSV files (if supported - e.g. T212 + Schwab + IG).

Both cgtcalculator.com and UK CG Tax Calculator give identical CG results.

For Interactive Investor


NEW! I have made an online version which you can use with both cgtcalculator.com and the UK CGT Tax Calculator on my easy2boot.xyz site  here. No trade data will leave your PC.

OR -

Download_ii_Convert_v4.5.zip -. Run from Windows by double-clicking on the extracted exe file (.exe + .py source code included). Accepts multiple csv files. Stock split action currently untested. Alternate download source: OneDrive.

To download each converter tool, click on the download arrow icon at the top of the page...

Just run the .exe file from a Windows system or the included .py Python scripts (source  code) can be run from a Windows, Linux or Macintosh command line if Python has been installed on your system.

No information will leave your computer. No internet or other external connection is made by the conversion utilities. Please use these tools at your own risk - it is your responsibility to check the results (or use an accountant)!

Note: There is now also a new 'UK Tax Calculator' online tool which works directly with Trading 212 csv files and requires no conversion tool. It reports Capital Gains, dividends and ERI and gives similar results to cgtcalculator.com (see Links section below). For ii and other brokers, you may need to convert the csv file to the cgtcalculator.com format first but many converters are available for other brokers (see the convert page).

See also: 'Choosing the best trading platform for a GIA'

NOTE: You should not use any figures for your tax return until 6th May or later. The transaction CSVs must include all orders made 30 days after 5th April because some BUYS after 30 days may affect the reported gains due to the HMRC 30-day rule.

Both cgtcalculator.com and UK CG Tax Calculator give identical CG results.

Converters for other broker platforms

For ii and other brokers, you may need to convert the csv file to the cgtcalculator.com format first but many converters are available for other brokers (see the convert page). Both cgtcalculator.com and UK CG Tax Calculator accept space-separated text files with no header row. This blog article here may give you useful information about other broker platforms.

Introduction

cgtcalculator.com is a free website that will calculate the capital gains on your share/stock sales.

It requires trade order data in this format as either a Buy or a Sell (data separated by spaces - no header row)...

B 12/01/2004 AVG 10000 0.525 10.0   26.25
S 23/02/2004 NCH 5000 1.75         12.50   0.0

which corresponds to this type of structure and format...

B/SDateCompanySharesPriceChargesTax
B12/01/2004AVG100000.52510.026.25
S23/02/2004NCH50001.7512.500.0


You can highlight all data cells (exclude heading row) from an Excel spreadsheet and paste them into the online calculator data window or load a .txt file directly into the calculator.

Instructions for using cgtcalculator.com are here.

Your broker (e.g. Trading 212, Interactive Investor, etc.) will allow you to download your order data (usually as a .csv file or .xlsx) but it will not be in the format required for cgtcalculator.com.

Although some conversion facilities for some brokers are provided on the cgtcalculator.com's convert page, there is no converter for Trading 212 available on the site so you will need to use my converter. Also the Interactive Investor converter on the site has a bug (it does not handle stocks which were bought in $USD accurately due to a bug in the ii csv files - ii data .csv files shows the price of $USD shares in £GBP, e.g. '£3.5' when it should be '$3.5' !!!).

To calculate CGT, the complete buy/sell history is needed. Most brokers only allow you to download one or two years of transactions at a time. This means you will need to manually combine all your downloaded files into one single file before you can use the cgtcalculator.com converters. However, my converter allows you to select all the csv downloaded files and makes one single file which is suitable for direct use with cgtcalculator.com.

The T212 and ii 'Convert' utilities

I have developed some Windows executable files (.exe) which you can use to quickly convert all your downloaded transaction .csv files into a single text file (.txt) suitable for use with cgtcalculator.com.

Three simple steps will calculate your Capital Gains - 
1. download csv files from broker
2. convert to a .txt file
3. load into cgtcalculator.com

Step 1 - Download the .csv transaction files

The last transaction date must be at least 6th May after the end of the tax year (because trades within 30 days of April 5th can affect CGT calculations due to the 30 day rule). The first date should be the date that you first opened the account. I suggest naming files for each calendar year, Jan 1 to Dec 31 - e.g. t212_2024.csv, ii_2024_2025.csv, etc.

Trading 212
Download Trading 212 .CSV files - select your Invest account. Use the three bar hamburger menu - History and Orders. Then click the download icon on the Trading 212 page... 
Now download ALL your orders for ALL years as CSV files (max. 12 months per download). Select only ORDERS and not all transactions. Don't worry if some files have overlapping dates, the convert app will remove duplicate trades - just don't miss out any dates! The first download file should start from the day you opened the T212 Invest account.

Interactive Investor
Download Interactive Investor .CSV files - on the ii website in your browser (do not use the ii app) - click on 'Site Map' at the bottom of the page and choose 'Transaction History'. Choose the time period (max 24 months per csv) and then click the download icon 


Repeat the download for all years. I suggest making 2 year downloads, each starting at 1 Jan and ending on 31 Dec (up to at least May 6 2026). Save as CSV (not as a PDF).

Step 2 - Convert the data

For Trading 212 csv files, you can use my browser-based converter here which I have placed on a page on my easy2boot.xyz website. No trades data will leave your system.

For Interactive Investor csv files you can use the browser-based converter on my easy2boot.xyz site here. No trades data will leave your PC.

Otherwise...

Download the Convert utility (link above) and unzip it. The Windows .exe file can be copied to the same folder as your .csv files or it can be placed on the Windows Desktop. The .py is the Python source file and is not required but is just for your reference (you can instead run the .py source file if you have Python already installed but you must specify each csv file on the command line separated by spaces).

The convert .exe program, under Windows, will allow you to pick one or more .csv files by using Ctrl+left-click on each of your .csv files (see Fig. 1). Select ALL your downloaded files for ALL years.

Fig. 1 Pick all .csv files to cover your entire investment period using Ctrl key+left-mouse-click



Fig. 2 Example when multiple .csv files are picked.

The convert program will output a .txt file (amongst other files) for use with cgtcalculator.com (see Fig. 2).

If you see many 'possible split' errors, you probably have missing orders. Check the output csv or txt file for missing dates. The first trade listed should be the first Buy when you first opened the account. All trades, up to May 6th or later of the last year should be included.

If manual changes are required, the output .csv file can be loaded into Excel and you can adjust the data. You can then copy and paste the data columns into the cgtcalculator.com box (without headings).


Fig. 3 Example of the online version of the T212 converter tool.
Stock splits are auto-detected and corrected.



Fig. 4 Example of an Interactive Investor conversion to cgtcalculator and UK Tax Calc formats.
Stock splits are untested.



On Mac\Linux platforms, you can run the .py program from the command line once you have installed Python (Python+Tkinter is required). Specify all your csv files on the command line, e.g.

python3 T212_convert_v11.6.py 2024.csv 2025.csv 2026.csv

Step 3 - Use cgtcalculator.com

Go to the cgtcalculator.com site and click on 'Choose File' and then select the .txt file that was made by the Convert program. You can instead just paste in the converted data using Ctrl+V if it is already on the clipboard.

  1. Now click on 'Format/Sort' and check it looks OK (optional - it orders by date)
  2. Ensure the 'apply rounding' option is unchecked - see picture below.
  3. Enter the desired tax year if you don't want all years to be shown (optional). 
  4. Finally click on the red CALCULATE button.
Fig. 5  Cgtcalculator.com calculator page with results.

The 'CapitalGain' figure (e.g. 6713 in the example case above) can be used in your tax return.

Note: cgtcalculator.com does not calculate ERI on accumulating ETFs and so does not subtract ERI from any gains. If you are a basic rate taxpayer, this may mean you will be paying slightly too much capital gains tax.

Note that my conversion tools calculate the share price from the total return or total cost divided by the number of shares, so the 'charges' and 'tax' columns will be 0 because they are amortised into the net share price.

Strictly speaking, if you have GIAs with more than one broker, you should combine the .txt Buy/Sell text files into one single .txt file for use with cgtcalculator.com. This is because you could have sold shares of ABC with one broker and then bought back ABC shares on a different broker site within 30 days - this will affect your CGT under the 30-day HMRC rule. If you haven't bought any of the same shares within 30 days then you can assess CGT separately for each broker.

Using conversion websites it is easy to combine T212 + ii trades for example:
  1. Copy the T212 TXT output the clipboard and paste into the cgtcalculator.com field
  2. Copy the ii TXT output to the clipboard and paste it into the cgtcalculator.com field below the first set. 
  3. cgtcalculator.com will now combine all trades and apply same day and 30 day rules - this may return a capital gain figure which is very different from if you simply calculated the gain seperately and then  added them together!

About ERI (UK HMRC rules)

Excess Reportable Income (ERI) is the portion of income that accumulating funds receive but which is not distributed to investors - essentially, income that’s reinvested back into the fund.

Even though you don’t receive this income as cash, HMRC still considers it as taxable each year.

ERI applies to the accumulating share classes (marked as “Acc” or “Accumulating”) of offshore UK reporting funds (i.e. most Irish or Luxembourg-domiciled ETFs). 

ERI is usually counted as dividends, but some types of funds may class ERI as Interest (e.g. some Money Market Funds). Also, sometimes distributing funds also may have a small ERI.

ERI which is paid as dividends is subject to dividend tax. When you sell the fund, all the ERI that you notionally received over the years that you held the fund, can be added to the cost of the fund (i.e. the gain you report on the sale can be reduced by the total amount of ERI paid on those shares over the time they were held, since you will have paid dividend tax on that portion over the years you held them).

ERI is not accounted for by cgtcalculator.com. If you are a Basic Rate taxpayer, then you may be paying slightly more tax than you need to (dividend tax is less than CGT for basic rate taxpayers), but calculating ERI is extremely tedious. For this reason, most people avoid accumulating ETFs in a GIA and instead they just buy distributing ETFs inside a GIA.

No ERI reporting or any type of dividend or CGT or other tax (except stamp duty when buying UK shares) is applicable for ISA or SIPP accounts.

Older cgtcalculator.com conversion programs for Windows

For reference, here are some older versions of the converter tools which may have bugs or reduced functionality.

Older versions (v1-10 only run from Windows command line)
Download T212_Convert_v2.exe - ignores duplicate rows
Download T212_Convert_v3.exe - enhanced error checking and reporting
Download_T212_Convert_v4.exe - corrects small discrepancies in t212 csv files
Download_T212_Convert_v5.exe - warns of same day or 30-day buy back issues
Download_T212_Convert_v6.zip - extra checking, etc. includes .py source file and .exe Windows file
Download_T212_Convert_v9.zip - copes with Stock Splits if detected (.exe and .py)
Download_T212_Convert_v10.zip - later version, fewer bugs (.exe and .py)

Download_ii_Convert_v3.zip - converts Interactive Investor csv file (.py and .exe) - command line and single file only. To combine .csv input files, use the copy command (e.g. copy ii_2024_25.csv + ii_2026.csv ii_all.csv)

If you don't trust running strange .exe files from me then you can examine and run the .py script after you have installed python onto your Windows/Linux/Mac system.

*Check this page for future revisions or contact me. Unzip the zip file to extract the .exe file and .py file.

An interactive investor (ii) conversion program is also available because there are bugs in the converter for ii that is on the cgtcalculator.com site.

Extract the .exe file to the same folder that you have your .csv files in when using a command line version.

The .exe program is written in Python and has then been compiled into a Windows .exe. I used ChatGPT to make it for me since I don't know Python very well.

Action of T212_convert.exe (latest version)

  • Read in all .csv files - this may contain multiple files and duplicate lines. Files containing orders can be downloaded from T212 - ALL ORDERS for ALL YEARS must be downloaded - if you held the account for 6 years then all trades for all 6 years are needed. Downloads for the last year must  include orders up to May 6th as trades up to 30 days after the tax year may affect the calculations. Later versions (v11+) allow you to select multiple files from a Windows pop-up.
  • Ignore non-trade/non-split rows and deduplicate.
  • Check and sort Buy and Sell orders
  • Adjust Qty and Price in shares if a stock split is present or detected
  • Check for Oversells (selling more shares than you hold) and ignore small discrepancies (e.g. hold 9.0 but sell 9.0000001 shares)
  • Adjust Qty and Price for any declared stock splits
  • Check for any Buy within 30 days of a sell (HMRC same day and 30-day rules will apply when processed later) - warn user
  • List number of Buys and Sells and total orders
  • List files output including a Warnings .csv and a stocks .csv (with same data as the output .txt file) which a user can manipulate and then cut and paste into cgtcalculator.com
  • List orders which have been changed by the program (due to small discrepancies, splits, etc.)
  • The output .txt file can be directly imported into cgtcalculator.com

Note: Sometimes, in cgtcalculator.com, the fractional sells do not match the buys by a very small amount due to very small decimal errors (the sells in the T212 downloaded csv don't always add up exactly to the buys). These may be detected and corrected automatically. This may be the result of small errors in your broker's csv files too.

cgtcalculator.com may display an error:

**** ERROR in trades data(283) There are more SELLS than BUYS for stock SOFI OR your dates are incorrect (make sure at some time you havent sold more than you own) for stock SOFI

An easy way to fix this is to very slightly increase the number of the shares bought. e.g. increase 4.53212 shares bought to 4.53213 shares bought or very slightly decrease the number sold within the cgtcalculator.com edit box. T212_convert version 4+ and ii_convert_v3 may automatically fix these small discrepancies for you.

Tip: Saving as .csv file from Excel

When saving in Excel as a .csv, only use the first .csv option - do not use the MS-DOS or Macintosh options for a plain "CSV" .csv file or you will get strange characters in the .csv file...

Fig. 6 Use the first .csv option when saving files in Excel


The xxx_warnings_CVT.csv output files contains lines which cannot be handled by the conversion program - e.g. stock split notifications.

Useful Links

For more information:
  • Blog article on the development and more details about these tools
  • Save tax (ERI) article
  • Avoid paying too much tax (ERI) article

  • NEW! - UK Tax Calculator (includes support for ERI) - New and alternative calculator that supports Interactive Brokers, Charles Schwab, Trading 212, Vanguard UK and cgtcalculator.com format text files (must have a csv file extension) so far. A nice PDF report is produced for your tax return. It seems to return similar results to cgtcalculator.com (if you exclude ERI). Multiple .csv files can be loaded at one time making it extremely easy to use - just download all your downloaded trade .csv files and load them all into the app using Ctrl+left-click to select each csv file, no converter program is needed. You must include all trades and transactions (not just orders) but dates must not overlap as it does not deduplicate. Reports from two or more different brokers can be loaded at the same time to combine orders.
You can use both cgtcalculator.com and the new UK Tax Calculator and compare the results. They should be show very similar Capital Gains results (you must untick 'include ERI' on the UK CG Tax Calculator and untick the 'apply rounding' option on cgtcalculator.com).

Contact me at easy2boot at gmail . com  if you have any queries.

If you want a similar conversion program for your broker (if not T212 or ii), you can to send me your .csv files for test purposes. If possible, with examples of stock splits in them.

Please let me know if these free tools have been useful to you as I have spent a great deal of time writing, testing and improving them.

Steve

P.S. Signup using this link for a free fractional share in Trading 212 worth up to £100 (and I will get a reward too ;-)

Steve's eBooks: here rated 4.5/5 stars (some are free).

No comments:

Post a Comment