There are a few ways.
For stars on the main sequence – most stars – mass and brightness and color are all very closely related. So if you know a main sequence star is blue and bright, you know it’s high mass, and if it’s red and dim, you know it’s low mass.
For other kinds of object, like neutron stars or black holes, mass limits are known. All known black holes are above a certain size; all neutron stars are below a certain size.
For galaxies, you make an estimate based on their brightness and on the gravitational pull between them and nearby objects, or on how they lens different objects.
In general, it just depends on the object you’re looking at and how far away it is, and there is a lot of error in those estimates.
Latest Answers