Use du when the object of the sentence is singular. du is short for de le, and des is short for de les, so:
Il vient du jardin.
Je voudrais du gâteau.
Je voudrais des pommes.
In your examples, crayons is plural (so des is used) whereas fromage is singular (so du is used).
Jez’ answers misses a crucial point, I’m afraid: you can say des fromages!
The distinction is simply between mass nouns (which allow the use of de with a singular) and count nouns (which don’t). You can say Je veux des crayons (in which des does not mean “of the”) because you can use that with almost all French nouns (there are very French words that are not count nouns in at least some meanings), but you can hardly say je veux du crayon because crayon is not a mass noun (vs. la mine du/des crayons, “the pencil’s/pencils’ lead”)
The distinction is only troublesome to English speakers because English drop articles for both mass nouns and count nouns (compare I’m eating cake/cakes and je mange du/des gateaux, which make exactly the same distinction).
Use du (masculine) or de la (feminine) followed by a singular noun for uncountable quantities. Use des followed by plural for countable ones.
De la patience.
Des amis et des amies.
Some nouns can be both uncountable and countable:
De la bière.
Des bières. (Note: might stand for several beer cans, or several beer sorts.)
Note: du or de la don’t always denote uncountable quantities, as de is a widely used preposition in French.
Ils parlent de la pluie et du beau temps.
If you would like to use an indefinite quantity following a de preposition simply use de + singular (uncountable) or de + plural (countable), without an additional article. Examples:
Ils parlent de bonheur.
Ils parlent d’amis.
Note that using “du bonheur” (the general notion) would mean something different from “de bonheur” (some subset of the general notion). Same for “de l’ami” (the friend, i.e. a specific friend), “des amis” (all of them), or “d’un ami” (one of them); all are different from “d’amis” (some of them).
Some of the most difficult words in a language are articles and prepositions. The words du and des can combine a preposition with an article, so it’s inevitable that this can get a little complicated.
The word du is always a contraction of de le. The corresponding feminine form is de la, and we use de l’ for the masculine when it’s followed by a vowel. The plural is des. Then, to complicate matters:
- In de la and the others, the word de can either be the preposition de (which has many meanings; the English preposition “of” is often close), or the first part of the partitive article du/de la/de l’/des.
- The word des can not only be the plural partitive article or the preposition de run together with the definite article les, but also the plural indefinite article (plural of un).
In your example sentence, du is a partitive article. Du fromage is the singular form, and des fromages is the plural form.
The singular form du fromage uses fromage as an uncountable noun. “Je mange du fromage”: “I’m eating cheese” (or “I’m eating some cheese” or “I eat cheese”; French doesn’t normally distinguish between these). The singular is used because cheese is a substance, and I’m eating an indeterminate amount of that substance. Contrast:
- Je mange du fromage. (I’m eating some cheese now.)
- Je mange des fromages à pâte dure. (I eat hard cheeses. The plural is used because fromage here means “a type of cheese”.)
- Je mange du riz. (I’m eating rice. Rice is uncountable.)
- Je mange des pommes de terre. (I’m eating potatoes. You can count potatoes, so we use the plural — even if the potatoes happen to be in the form of purée, i.e. mashed potatoes.)
- Je bois du thé. (I drink tea.)
- J’ai bu trois thés aujourd’hui. (I’ve drunk three teas today, i.e. three cups of tea.)
- Je préfère les thés peu fermentés. (I prefer teas (i.e. varieties of tea) that are lightly oxidized.)
Use du (masculine) or de la (feminine) followed by a sing. noms for articles indéfinis(uncountable) while des followed by plural noms for article définis(countable).
example of articles indéfinis
sing. UN livre
plur. DES livres
sing. UNE table
plur. DES tables
example for articles définis
sing. LE livre
plur. LES livres
sing. LA table
plur. LES tables
The preposition de can be very difficult French word, even at advanced levels.
de is “of” and a bunch of other things
du = de + le
des= de + les
du, de la de l’, and des all directly translate to “of the” however
they have other uses.
Unspecified quantities represent the notion of “some” in English, but we don’t always use the word “some.” When you are talking about a portion of one item (food, like “some bread”), or something that cannot be quantified (quality, like “some patience”), use what the French call “a partitive article.”