Algae control is inevitably an issue in any aquarium. It is effectively impossible to completely prevent it. There are many types of algae that are common and all have various causes and cures.
It is important to understand the big picture of algae and its main cause, an overabundance of nutrients. And overabundance of nutrients (usually nitrate and phosphate) is caused by an imbalance of nutrient input and nutrient output in the system.
Nutrients In and Nutrients Out
Nutrient input can come from two places: the water used for water changes and feeding. The water used for water changes can introduce nitrate and phosphate into the system. Feeding can greatly contribute to nutrient input in many ways. Any food will introduce nitrate and phosphate, but higher quality foods will introduce less. Foods with lower quality ingredients are less digestible and therefore more passes through the fish and comes out as waste. Overfeeding also contributes to excess nutrients because the extra food will simply rot. In a marine aquarium the nutrient input caused by using tap water can be the difference between a pristine reef aquarium and an algae farm. Marine reef ecosystems have almost no free nutrients in the water column. What is introduced by using tap water is more than enough to exceed natural conditions and provide more than enough food for marine algaes.
Nutrient output can be a little more straight forward. Water changes remove excess nutrients and provide the nutrient export needed in most freshwater systems. Most cases of algae problems can be completely fixed by improving the water change schedule (frequency and/or amount per water change). In fact the main thing to determine if enough water changes are being done is to test the nitrate concentration. Live plants can help remove excess nutrients by outcompeting the algae for the nutrients. However, this does not remove the need for water changes. In marine systems live rock itself can help remove nitrate. There is also the option for a refugium, a space (usually a section in the sump) designated for growing macroalgae. The macroalgae outcompetes the algae for the nutrients. So by growing the good macroalgae in the sump you can minimize or prevent the bad algae from growing in the display.
By fixing the factors contributing to an imbalance of nutrient input and output most algae problems can be corrected.
It is important to point out that algae itself usually does no harm to the aquarium in any way, in fact it can be very beneficial. Most people consider most types of algae as ugly and undesirable and that is why it is removed. Some types, like black hair algae/black brush algae, can actually do harm by clogging filters and even choking fish (rare, but it has been reported). Most types of algae provide a very natural food source for many fish, from herbivores feeding on the algae directly to other fish feeding on some of the fauna that thrive in the algae. Many people have found that by letting the algae grow their fish actually did better.
Lighting and Photoperiod
It is important to point out that lighting can be the main cause of algae. Of course it requires that nutrients are available for the algae to consume, but just changing the lighting is sometimes the only fix needed.
As light bulbs get older they give off a different color light. So although a fluorescent light bulb may still turn on after two years of use, the intensity and color of that light has changed significantly. Changing the bulbs may be the only thing needed to correct an algae problem (and can look like you have a brand new light fixture).
The other issue is photoperiod, the amount of time the lights are on. Most people keep the lights on all day. They turn them on when they wake up and turn them off when they go to bed, or have a timer that does the same thing. However, this is A LOT of light for most aquariums, and you probably aren’t around most of the day to enjoy the fish anyways. Instead, put the lights on a timer and set it to turn them on for a few hours in the evening when you will actually be around to enjoy the fish. This may be something like 6pm to 10pm. The lights are on for a lot less time each day which can completely fix many algae problems. The fish don’t care. As long as they can tell day from night they are fine (any window in the room is enough for this).
Natural Algae Control
In most tanks algae control is desirable and can be achieved in many ways. I prefer to stay as natural as possible. I do this by relying on algae eating fish for algae control (instead of me scrubbing all the time). My favorite is bristlenose plecos. They eat almost every type of algae, do well in any hardness (from 4.5 with discus to 8.2 with African cichlids), do well in any temperature (from room temp with goldfish to 88F with discus), and do not bother fish or plants the way that many other plecos can. Many other species will destroy plants and can even suck on the sides of discus and goldfish, something I have never seen any bristlenose ever do. Other fish can be great for algae control as well. Otocinclus catfish (ottos) and Siamese algae eaters are very popular and safe options. The only problems with these is that they are so small, so they may not be a good option if there are other fish in the tank that are large enough to fit them in their mouth. Avoid common plecos, they get way too large for almost any aquarium, do not eat algae after a certain size, and can produce unbelievable amounts of long strings of poop. Avoid Chinese algae eaters, frequently just called algae eaters. They can become very aggressive as they get large and end up causing many problems for the other fish in the tank. Many people have also found that they too, like the common pleco, are not effective at algae control after a certain size.
Unnatural Algae Control
If natural algae control methods are not enough or not an option due to the type of fish being kept there are other options as well. One of the best investments you can make is to buy a Mag-Float. These are two piece algae scrapers that attach to the tank with a magnet. One side has a rough pad and goes inside the tank, the other has a soft pad on it and goes on the outside. This allows the aquarist to wipe algae in a matter of seconds, without having to stick their arm in the tank and inevitably drip water outside the tank. This means that algae wiping is easy, and easy means it actually gets done. A decent option is to simply cut back the amount of time that the lights are on. Many people turn the lights on when they wake up and turn them off when they go to bed. This means the lights are feeding algae for about sixteen hours every day. Putting lights on a timer is a cheap and effective way to keep this under control. You can go a step further and only have the lights on while you are home in the evening, when you will actually be able to enjoy the tank. This brings the photoperiod down to only four to five hours. In some cases this is simply hiding a symptom of a larger problem, inadequate water changes. Cutting back the lights is not meant to replace water changes in any way. It is only a way to fix a problem of the lights being on too long or if algae persists even when the water quality is high (some types of algae can be harder to get rid of then others).
In extreme situations even more action needs to be taken. Some cases of algae are so bad that a blackout or chemicals are required. A blackout consists of turning the lights off and covering the tank to completely block out all light. Before doing this physically remove as much algae as possible and do a large water change to remove as many nutrients as possible. Cover the tank and block out all light for at least three days, during which time you do nothing to the tank. You do not feed the fish nor do you peak in to see what is going on. This should deprive the algae enough to kill it off. Live plants may not look great after a blackout, but should come back without any issues.
I prefer to avoid chemicals of any kind as much as possible, but unfortunately some types and situations are simply too much for other methods. The main type of algae that requires this in my experience is greenwater algae. Some people have successfully treated it with blackouts, but I have found that the use of AlgaeFix is more reliable and works almost immediately. The first time I used it I saw an improvement within hours. The next morning the tank was crystal clear and I would have never guessed the tank had recently had an algae problem if I hadn’t seen it for myself.