This article seems to indicate that "a small amount of Chlorine may be produced as you [perform electrolysis on water]". Is this true? I thought it was just H2 and O2 produced.
It's the tablespoon of salt he added, giving the chlorine when electrolysis is done. I have done electrolysis with salt-free water (though a bit acidic to get the water to electrolyze faster) and chlorine was nowhere to be found.
Electrolysis of saltwater produces hydrogen and chlorine; and leaves sodium hydroxide behind.
You get chlorine gas as a product only when NaCl is added, as mentioned by @Nihilist_Frost. Even on addition of NaCl, oxygen gas must be the product(expected) because it has slightly lesser reduction potential than chlorine. But this is not the case because of over-potential of oxygen, which makes this half-reaction unfavorable. This is specifically termed as Bubble Overpotential.
P.S.: I tried to find a link for bubble over-potential, but I am afraid it is not available on the internet.
P.S.S.: Electrolysis of pure water produces only H2 and O2, and that too of very high purity (in the range of 99.5%)
I've read the question and read the replies. Firstly the question is misleading as water does not conduct electricity, it is only the impurities in the water that do which is why an electrolyte is always added to water during the process of electrolysis. Secondly when an electrolyte is added to water the water becomes a solution of the electrolyte, for example, add sodium chloride to water it will become a sodium chloride (salt) solution. So when we look at the products of the electrolysis of a salt solution we can see that we are splitting the sodium from the chloride producing chlorine at the anode and a sodium based gas at the cathode (which is palmed off as hydrogen). This is characteristic of any electrolysis process involving a solution. So to answer your question, one should always produce chlorine by electrolysis when there is a chloride present in the solution.
If you pass current through salt water (sodium chloride solution), you will produce chlorine preferentially to oxygen.
In practice, this chlorine will attack your anode if it's made of copper, or steel, or most any other metal. Since the linked demonstration uses pencils (graphite), that doesn't happen. Instead, the anode produces free chlorine, which dissolves in the water. The cathode produces hydrogen, leaving hydroxide ions.
So, now you have an aqueous solution with sodium ions, chloride ions, hydroxide ions, and free chlorine. The dissolved chlorine reacts with the hydroxide ions, disproportionating into chloride and hypochlorite. (If the solution is hot enough, it can go all the way to chlorate.) This is how bleach (sodium hypochlorite) is manufactured industrially.
In other words, this process won't produce bubbles of oxygen. It will produce chlorine, but probably not as bubbles of gas. If you want to produce oxygen, use sodium or potassium hydroxide solution, not salt water.
If you don't want to have chlorine gas as byproduct in your electrolysis add sodium or potassium hydroxide - you would get O2 and H2.
Water electrolysis is even possible with distilled or deionized water, because due to the CO2 in the air, there are always some HCO3 ions in solution that will aid electrolysis (given the voltage is high enough).