Preferably in economic terms, although others would definitely be appreciated too!
This is a tough question. Any cost-benefit analysis depends on assumptions about what otherwise would have happened. Which is one thing if you're assessing something discrete like a sewerage treatment plant, another thing if you're assessing political developments in countries from India to Uganda to New Calendonia over 100 years, and what other colonising countries like France or Russia might have done differently. Japan is a vivid reminder that in the absence of colonial activity, non-European nations would not necessarily have remained economically static.
The normal argument that colonialism benefits the colonising country by monopolising trade with the colony to the coloniser. Adam Smith in [The Wealth of Nations, book 4, chapter 7](http://www.econlib.org/library/Smith/smWN17.html#B.IV, Ch.7, Of Colonies) pointed out that these monopolies not only harms the colonised, but raise prices for consumers in the colonising country, and the reduction of the incomes of the colonised reduces their ability to buy other stuff from the colonising country, reducing incomes of the coloniser overall again. To quote Adam Smith:
The monopoly of the colony trade, therefore, like all the other mean and malignant expedients of the mercantile system, depresses the industry of all other countries, but chiefly that of the colonies, without in the least increasing, but on the contrary diminishing that of the country in whose favour it is established.
And his summing up:
Under the present system of management, therefore, Great Britain derives nothing but loss from the dominion which she assumes over her colonies.
But The Wealth of Nations was published in 1776 and in its turn influenced not just economists, but British policy towards its colonies. The strongest argument I've heard for colonies being a net benefit for Britain, though I'm grading on a curve, is Niall Ferguson's argument that the British Empire in the latter part of the 19th century imposed freer trade on its members than they would have had as independent states. See Empire: How Britain made the modern world, 2012. Against Ferguson's argument, however, Andrew Porter points out in his review of said Empire that the British carried out a number of 19th century wars which were very costly in maintaining its empire. Note that wars not only impose direct costs to fund, but the people killed and infrastructure destroyed are lost to future production and innovation, to the harm of the survivors. Porter also however makes some puzzling statements in his review, like the assertion that:
free trade...generally operates over any significant period of time to the decided disadvantage of commodity producers.
This is puzzling. If free trade is operating to the disadvantage of commodity producers, in a free market the commodity producers presumably would stop trading commodities and either naturally take up autarky ("economic independence or self-sufficiency", normally something politicians try to impose on their country), or branch out into things other than commodity production, like taking up manufacturing. Indeed a common criticism of colonialism is that the coloniser often takes steps to stop this adjustment happening (see for example this question on British treatment of the Indian textile industry by u/Snapshot52 on this subreddit and I’ll add a ping for u/DaManmohansingh for the response.) (Adam Smith had the insight that these colonising steps, in suppressing manufacturing harmed the general population of the colonising country as well as the colonised.)
On top of the cost of wars, the British empire was often unpopular with its subjects, and many people spent considerable time and effort protesting for independence, taking resources away from increasing productivity, or artistic works, or innovations that could have indirectly benefited Brits. Gandhi's policy of non-violence still took considerable time away from doing things that could have improved India's living standards, with flow on gains for the rest of the world (aka richer Indians could have brought more British goods.)
If you postulate a world without the British empire where, say, France and Russia have colonised everything the British did and imposed mercantilism, then the British empire was probably a net benefit. If you postulate a world of peaceful-ish independent countries, generally willing to trade with the British, then it was probably a net cost. But industrialisation is not cost-free, if you postulate worldwide industrialisation in the 1900s would have led to a widespread environmental crisis, then you could come up with yet a different answer.
So, basically, all this is very hard and gets very ideologically loaded.