Non-metals usually have a higher electronegativity than metals. Therefore, when hydrogen bonds with a metal to form a metallic hydride, it is almost always the anion, or negative ion. As an anion, hydrogen controls the metal's electron most of the time, giving it a negative charge, while creating a positive charge on the metal. These opposite charges create an even stronger bond between the atoms through electrostatic attraction. Examples of metallic hydrides are lithium hydride (LiH), sodium hydride (NaH) and sodium borohydride (NaBH4).
When hydrogen loses its electron, it becomes a hydrogen ion (H+). This often occurs when hydrogen forms ionic compounds with more electronegative non-metals, such as the halogens in group 17 on the periodic table. These compounds often form strong acids when dissolved in water because the hydrogen ions break off easily and bond with a base -- the definition of a Bronsted-Lowry acid. Hydrogen fluoride (HFL), hydrogen chloride (HCL), hydrogen bromide (HBr) and hydrogen iodide (HI) are examples of such compounds.
When hydrogen bonds with another hydrogen atom or with a non-metal that has a similar electronegativity, it forms a covalent compound. The atoms in these compounds share their electrons with one another so that each atom possesses one more than it had when it was unbonded. These compounds are among the most common in the world and include water (H2O), hydrogen dioxide (HO2) and ammonia (NH3). The only pure covalent bond is hydrogen gas (H2), since both atoms have exactly the same electronegativity. Most other non-metals have somewhat higher electronegativities than hydrogen and form polar covalent bonds in which the electrons are shared between the two atoms, but unequally, with hydrogen controlling its electron less often than its partner element.
Hydrogen is an essential component of a special group of covalent molecules called organic compounds. These compounds are essential to life and include groups such as carbohydrates, lipids, proteins, and amino acids. They also form common substances such as plastics, synthetic materials and petroleum products. In these compounds, hydrogen bonds covalently with carbon. Molecules that contain only these two elements are called hydrocarbons and usually come from fossil fuels. Examples of hydrocarbons are methane (CH4), propane (C3H8) and octane (C8H18).