# Order of elements in a formula? [duplicate]

If I have a formula containing 4 hydrogen atoms and 1 carbon

Should it be written $\small\ce{CH4}$ or $\small\ce{H4C}$?

In general, how do I know the order to put elements in, in a chemical formula?

So it should be: $\ce{CH4}$