We employ a model characterized by costly trade, love of variety, heterogeneous firms, labour mobility as well as endogenous markups and productivity. We quantify the model using goods and services trade data as well as GDP and population for EEA countries/regions plus BRIC countries and other OECD countries. We finally compute, starting from the observed initial situation in the year 2016, counterfactual economic changes stemming from changes in trade costs related to the implementation of both a soft and a hard Brexit. We find that Brexit would have a significant impact on the UK and EU economies. A hard Brexit could lead to annual welfare losses of 57 billion euros in the UK and about 40 billion euros in other EU countries. A soft Brexit would strongly mitigate these losses. Productivity losses and markup increases drive the simulated effects.