In German it often occurs that definite articles and prepositions are contracted. This is, however, only possible when the article is not stressed. The contracted form of the definite article is called clitic – an unstressed ‘word’ that only appears when it can lean on another word. Clitics do also, in other grammatical forms, exist in English, e.g. don’t, haven’t, and doesn’t. The English clitic n’t cannot exist without verbs like do, have, and does. These circumstances of the case do also apply to the German rule of blending definite articles and prepositions. The only definite articles that can be contracted are: “dem”, “das”, and “der”. All other definite articles do not occur as contracted forms.
In order to obtain such contracted forms, all you have to do is to retain the preposition and add the last letter of the definite article to it, e.g. um das becomes ums, bei dem becomes beim, etc. The only exceptions are constituted by prepositions that end with n like in, an, and von when they are combined with ‘dem’. Here, you have to remove the n and substitute it with an m. Below you can find a list of those contracted forms.
an das = ans / an dem = am (on the; at the)
auf das = aufs (on the)
bei dem = beim (with the; at the)
durch das = durchs (through the; because of the)
für das = fürs (for the)
hinter dem = hinterm / hinter das = hinters (behind the)
in das = ins / in dem = im (in the)
über das = übers / über dem = überm (over the; about the)
um das = ums (around the)
unter das = unters / unter dem = unterm (under the)
von dem = vom (from the; of the)
vor das = vors / vor dem = vorm (in front of the; before the)
zu dem = zum / zu der = zur (to the; towards the)
Below you can find some example sentences, which should help you to recognize when you can use a contracted form of a preposition and a definite article and when not. Under a., you can find sentences with the contracted form because, here, the definite article is unstressed. Under b., you can find sentences that do not have contracted forms because, here, the definite article needs to be stressed as you refer to particular objects.
a. Hinterm Haus gibt es einen Spielplatz. – There is a playground behind the house.
b. Hinter dem Haus, in dem ich wohne, gibt es einen Spielplatz. – There is a playground behind the house, in which I live.
a. Ich gehe gerne im Park spazieren. – I like to take a walk in the park.
b. Ich gehe gerne in dem Park vor meinem Haus spazieren. – I like to go for a walk in the park, which is in front on my house.
a. Sie zeigte mit dem Finger aufs Bild. – She pointed her finger at the picture.
b. Sie zeigte mit dem Finger auf das Bild mit den Blumen. – She pointed her finger at the picture with the flowers.