The heavy commuting burden borne by disadvantaged individuals and neighbourhoods is a key concern with regard to transport equity. Agreement on the best approach for addressing this problem has been elusive, however, and the existing literature is dominated by traditional survey approaches, which are liable to criticism for small sample sizes, especially when used in studies of megacities (those with populations exceeding 10 million). The aim of the present study was to help fill this gap in the literature by exploring commuting inequity and its determinants using big-data analytics, with Shanghai serving as a case study. A number of 81 million trips from 28 million transit smart cards in 2015 are analzyed. We found the top 20% of commuters in Shanghai, who accounted for about 78,000 of the cardholders, spent more than 60 min commuting each way daily. The results of a geographically weighted regression show that disadvantaged areas characterised by low rent or poor job accessibility tended to be inhabited by especially large numbers of workers with long commutes. Such commuters face a trade-off between housing and travel costs But interestingly, the areas with larger migrant populations have less long commuters. It suggests the development of sprawling housing and industrial areas and informal housing and economic sectors in the suburbs may have the benefit of enhancing the match between jobs and housing for the low-income migrants. Apart from providing more public transit services, inclusive transport policy in growing megacities should also pay more attention to individual people's capability to use the transport services.