A black hole is an object from which nothing, including light, is able to escape. As nothing can go faster than light, this can be more formally defined as an object for which the escape velocity is greater than the speed of light. In my post about escape velocity we found an equation relating the velocity required to escape from the gravitational pull of an object and that object’s mass.
In this equation, v is the escape velocity, M is the mass of the object we want to escape from and r is the distance from the center of mass of the object we’re escaping from. G is the gravitational constant.
If the required velocity v is greater than the speed of light, c, even light will not able to escape the object, making it a black hole. We have two variables, M and r, so we can derive two equations from this. One equation gives the distance from the center of mass required to make escaping from the object impossible given the mass, and the other gives the mass required given the distance from the center of mass.
The latter equation, r = \frac{2GM}{c^2}, is known as the Schwarzschild radius. It is the radius of the perfect sphere around the center of mass of the object, such that if all the mass is within that sphere the resulting escape velocity is equal to the speed of light. In other words, if the object were smaller than this, it would become a black hole. For Earth, the radius is slightly surprising:
So, Earth would only become a black hole if it was compressed to the size of a marble. A black hole can be smaller than its Swartchzschild radius, however. In this case, the radius acts as the event horizon of the black hole: matter, or information, inside the radius would not necessarily be inside the black hole itself, but it would no longer be able to escape to outside the event horizon. In other words: everything that happens inside the event horizon of a black hole, is invisible to outside observers.