Doctors have some of the highest salaries in the US.

An in-depth study from Doximity, a social-networking service for doctors, found that pay can vary a lot, depending on things like whether a physician treats kids, specializes in bladder diseases, or performs surgery.

Gender and racial pay gaps are also very real in medicine, the Doximity study and another new report from Medscape show.

Read on to find out how much each area of medicine makes on average, and where the wage gap between male and female doctors is most and least pronounced.

Healthcare is important, and doctor pay reflects that. Physicians have some of the highest salaries in the US.

Now we have details about just how much they make, thanks to an in-depth report from Doximity, a social-networking service for doctors.

Wages range a lot depending on what kind of medicine a doctor practices, with some specialties paying as much as $500,000 or $600,000 a year on average.

You might not be surprised to find that many of those top-paid doctors are surgeons, with brain surgeons topping the list. Some of the lowest-paid physicians treat kids, families, and older people.

Doctor salaries usually go up each year, but this year was the first since at least 2016 that they started to level out, the report found. Doximity tied this to big-picture changes in how people get healthcare in the US, with fewer doctors owning their own practices and more hospitals buying each other up and getting even larger.

Unfortunately, another factor in salary is a doctor's gender and race. Doximity found that the wage gap between physicians persists but seems to be narrowing. The study also identified the medical specialties where the discrepancy is largest and smallest.

Another report out this year from Medscape, a medical resource for doctors, showed a continuing discrepancy between the salaries of white physicians and physicians of other races.

Read more: The 10 best states to live in where healthcare is the cheapest

Doximity, in San Francisco, got started in 2011 and says more than 70% of US doctors are members. The company said that for the study it surveyed about 90,000 licensed US doctors who practice full time. Medscape, for its part, surveyed almost 20,000 doctors in more than 30 specialties.

Here's what we've learned.