Introduction - People's access to public healthcare can importantly contribute to reducing the prevalence of diseases and increasing life expectancy. Despite the advances of Brazil's Unified Health System (SUS), the country faces a permanent challenge in improving the coverage and equity of healthcare to reduce racial, spatial, and income inequalities in access to healthcare. Several studies have explored the spatial dimension of socioeconomic inequalities in access to healthcare in Brazil, but few analyze such inequalities within cities and bring evidence of racial inequalities. Methods - This paper presents the first large-scale study in Brazil examining the social and racial inequalities of access to healthcare at a high spatial resolution. The analysis covers access to primary and high-complexity public healthcare by public transport, automobile, and walking for the 20 largest cities in Brazil in 2019. Results - The results show that individuals with low income, regardless of race, have greater accessibility to primary healthcare in general. In contrast, individuals with high-income, mostly white, have substantially better accessibility to high-complexity healthcare. Yet, we find that racial inequalities in access to healthcare become much smaller when controlling for income. Conclusions - The results contribute to a better understanding of the geographical dimension of inequalities in access to healthcare in major Brazilian cities, showing how access to healthcare is strongly conditioned by social, economic, and transport-related factors.