molecalculator

Moles & Molar Mass

Molecules With Carbon and Hydrogen: Hydrocarbons

Calculator No. 01-5230 · Updated · Formula and assumptions shown below

Molar mass 16.0430 g/mol
Mass of one molecule
2.664 × 10−26 kg
Result, rounded to 6 decimal places
Carbon atoms
1
Set in the form below
Hydrogen atoms
4
Set in the form below
You enter
Carbon atoms, Hydrogen atoms
You get
Molar mass (g/mol), Mass of one molecule (kg)
Rounding
4 dp · 6 dp

For study and lab planning. The result follows from the numbers you enter and the formula shown. Check it against your method before you weigh, mix or dilute anything, follow the safety data sheet and your supervisor, and do not use it for clinical, dosing or medication work.

Molecules made only of carbon and hydrogen are called hydrocarbons. This page’s calculator works out a molecule’s molar mass from its carbon and hydrogen atom counts, returning the result in grams per mole; it does not identify a molecule from a formula or determine its structure.

Formula

The molar mass of a hydrocarbon is the sum of the contributions from its carbon and hydrogen atoms:

M = 12.011C + 1.008H

  • M is molar mass in g/mol.
  • C is the number of carbon atoms in one molecule.
  • H is the number of hydrogen atoms in one molecule.
  • 12.011 g/mol and 1.008 g/mol are the abridged standard atomic weights used here for carbon and hydrogen.

The second output converts the molar mass to the mass of one molecule. It divides M by Avogadro’s exact constant, 6.02214076 × 1023 molecules per mole, then converts grams to kilograms by dividing by 1000. The atom-count inputs must be whole numbers for an actual molecular formula, even though the calculator accepts nonnegative numeric entries.

Worked Example

The defaults describe methane, CH4: one carbon atom and four hydrogen atoms.

  1. Carbon contribution: 1 × 12.011 = 12.011 g/mol.
  2. Hydrogen contribution: 4 × 1.008 = 4.032 g/mol.
  3. Add the contributions: M = 12.011 + 4.032 = 16.0430 g/mol.
  4. Mass of one molecule: 16.0430 g/mol ÷ (6.02214076 × 1023 mol−1) ÷ 1000 = 2.664 × 10−26 kg (to six significant figures).

Assumptions

  • The formula represents one discrete molecule containing only carbon and hydrogen.
  • Standard abridged atomic weights are used; isotopic composition is not specified.
  • The result is a calculated molar mass, not a measured sample mass or a prediction of molecular structure.

What Counts as a Hydrocarbon?

A hydrocarbon contains carbon and hydrogen and no other elements. Methane (CH4), ethane (C2H6), and benzene (C6H6) are examples. Hydrocarbons occur in natural gas, petroleum, biological molecules and many manufactured materials, but the term describes composition—not where a compound comes from or what it is used for.

Many familiar organic compounds contain both carbon and hydrogen but are not hydrocarbons because they also contain elements such as oxygen, nitrogen, sulfur or halogens. Ethanol, C2H6O, is an organic molecule, but it is not a hydrocarbon. The distinction matters when interpreting a chemical formula: this calculator’s two-element mass sum is appropriate only when carbon and hydrogen are the formula’s sole elements.

How Formula and Structure Differ

A molecular formula gives the number of each type of atom in a molecule. It does not necessarily show how those atoms are connected. For example, butane and isobutane both have the formula C4H10, so both have the same calculated molar mass, but their atoms are connected differently. They are structural isomers and can have different physical and chemical properties.

Hydrocarbons are often grouped by bonding pattern. Alkanes have carbon–carbon single bonds; alkenes contain at least one carbon–carbon double bond; alkynes contain at least one triple bond; and aromatic compounds include ring systems with characteristic delocalized bonding. These categories help describe structures, but an atom count alone does not tell you which structure is present.

Using the Calculator and Interpreting the Result

Enter the number of carbon atoms and hydrogen atoms shown in the molecular formula. For a formula such as C3H8, enter 3 for carbon and 8 for hydrogen. The first result is the estimated molar mass in g/mol; the second is the calculated mass of one molecule in kilograms. For ordinary chemistry calculations, molar mass is usually the more useful result because it converts between a sample’s mass and amount in moles.

For example, the molar mass lets you calculate the number of moles in a known mass by dividing mass in grams by molar mass in g/mol. This arithmetic does not establish that a real sample is pure, or that its contents match the formula entered. If the sample is a mixture, its composition must be considered separately.

Limits and Common Mistakes

  • Leaving out another element: If the formula includes oxygen, nitrogen or another element, include that element’s atomic-weight contribution using a suitable method; the hydrocarbon calculator alone will undercount the molar mass.
  • Confusing a formula with a structure: Atom counts determine molar mass but usually cannot distinguish structural isomers.
  • Mixing units: Molar mass is reported in g/mol here. Do not treat that number as the mass of a whole sample; multiply by the amount in moles to obtain a sample mass in grams.
  • Overinterpreting precision: Atomic weights are conventional values, and real samples can have different isotope abundances or impurities. Extra displayed digits do not guarantee equivalent experimental accuracy.
  • Entering fractional atom counts: A molecule cannot contain a fraction of an atom. Use whole-number counts from a valid molecular formula.

The calculation assumes the formula is known and uses average standard atomic weights. Isotopically labeled compounds can have different molar masses; for those, use the specified isotope masses and isotope counts rather than the average values in this calculator. The result also says nothing by itself about volatility, flammability, toxicity or other hazards. For any bench work, follow your lab method, the safety data sheet (SDS) and your supervisor.

Frequently Asked Questions

What is a molecule made of carbon and hydrogen called?
A molecule composed only of carbon and hydrogen is a hydrocarbon. If it contains another element as well, it is not a hydrocarbon.

Are all molecules with carbon and hydrogen hydrocarbons?
No. A molecule must contain only carbon and hydrogen to be classified as a hydrocarbon. Ethanol, for example, also contains oxygen.

Is carbon dioxide a hydrocarbon?
No. Carbon dioxide is CO2: it contains carbon and oxygen but no hydrogen, and it is not a hydrocarbon.

Can two different molecules have the same formula and molar mass?
Yes. Structural isomers can share a molecular formula and therefore have the same molar mass while differing in how their atoms are connected.

Does a molecular formula show the molecule’s shape?
Usually not. A formula gives atom counts; a structural formula or other structural information is needed to show connectivity and geometry.

Related

Formula used
in c | Carbon atoms | - | 1 | 0
in h | Hydrogen atoms | - | 4 | 0
out mm | Molar mass | g/mol | c * 12.011 + h * 1.008 | 4
out mc | Mass of one molecule | kg | mm / 6.02214076e23 / 1000 | 6

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.

More in this section

The whole Moles & Molar Mass section →