A common type of black hole is produced by certain dying stars. A star with a mass greater than about 20 times the mass of our Sun may produce a black hole at the end of its life.
In the normal life of a star there is a constant tug of war between gravity pulling in and pressure pushing out. Nuclear reactions in the core of the star produce enough energy and pressure to push outward. For most of a star’s life, gravity and pressure balance each other exactly, and so the star is stable. However, when a star runs out of nuclear fuel, gravity gets the upper hand and the material in the core is compressed even further. The more massive the core of the star, the greater the force of gravity that compresses the material, collapsing it under its own weight.
For small stars, when the nuclear fuel is exhausted and there are no more nuclear reactions to fight gravity, the repulsive forces among electrons within the star eventually create enough pressure to halt further gravitational collapse. The star then cools and dies peacefully. This type of star is called a "white dwarf."
When a very massive star exhausts its nuclear fuel it explodes as a supernova. The outer parts of the star are expelled violently into space, while the core completely collapses under its own weight.
If the core remaining after the supernova is very massive (more than 2.5 times the mass of the Sun), no known repulsive force inside a star can push back hard enough to prevent gravity from completely collapsing the core into a black hole.
From the perspective of the collapsing star, the core compacts into a mathematical point with virtually zero volume, where it is said to have infinite density. This is called a singularity.
Where this happens, it would require a velocity greater than the speed of light to escape the object's gravity. Since no object can reach a speed faster than light, no matter or radiation can escape. Anything, including light, that passes within the boundary of the black hole -- called the "event horizon" -- is trapped forever.
HubbleSite and STScI are not responsible for content found outside of hubblesite.org and stsci.edu