Cloudy water occurs for a variety of reasons, the three mentioned earlier all are form very different sources, although I usually only work with two, milky and green.
Green water indicates that sunlight is hitting the aquarium for some period of time. The power of the sun causes an algal bloom that can rapidly turn the water into a green soup. There really isn't any instant cure. blocking the sun or moving the tank out if its reach is the long-term cure. The only way to actually kill the single celled plant cells is by use of an UV sterilizer. Those are expensive and purchasing one depends on the problem and your commitment to the aquarium. There used to be filter that could remove the plants - the Diatom by Vortex, but that was decades ago and there are no modern filters I know of that can remove such small cells.
The milky cloud is much more common, that is the result of a bacterial bloom - suspended bacteria get so dense in population that they can be seen as a milky cloud by the naked eye. The bacteria explode in population when the circumstances are right, basically there is an excess of dissolved nutrients in the water. This can come from two sources and is know by two different names. New Tank Syndrome occurs after about three days after a new aquarium is set-up. The new water is suddenly able to sustain life, and if it had lots of nutrients in it from the tap, the bacteria go wild and populate like crazy - it takes about three days before the cloud occurs. It can be brief, if no added food is provided, but if overfeeding occurs, the tank can remain cloudy for weeks, since the food is available to host the overabundance of bacteria. In older tanks, that is the main cause, overfeeding allows the nutrients in the waste and rotting food to dissolve onto the water column and give the suspended bacteria plenty to eat. They bloom and become the same basic cloud as from New tank syndrome, just from a different cause.
I don't use chemicals when this occurs, stop all feeding for three days to balance again. As the food is used by the bacteria, the rest starve and die back to clarity.
Once the three day fast is over, feed the fish what they can eat in two minutes, nothing hitting the bottom. Anything left over means the tank has been overfed. The whole environment will clean up and become more healthy for the fish over time.