im is the abbreviation for in dem – in the. It is used for masculine and neuter nouns together with the dative case. The feminine equivalent would be in die, which has no short form. The plural would be in den.
im is often used to specify a place (Wo?/Where?). For example: Robert ist im Büro - Robert is in the office. Der Hund ist noch im Haus. – The dog is still in the house.
ins is the abbreviation for in das – into the. It is used for neuter nouns together with the accusative case. The feminine equivalent would be in die, which has no short form. The masculine equivalent would be in den and also has no short form. The plural would be in die - into the.
ins is used with verbs of movement to specify a destination (Wohin?/Where ... to?). For example: Robert geht ins Büro. Robert is going into the office. Der Hund rennt ins Haus. – The dog is running into the house.
There are different types of prepositions in German: Prepositions of place, time, manner and reason /purpose.
Example with im (short for in dem): Er ist im Supermarkt. / Er ist im Büro. He is in the supermarket / He is in the office.
in is a preposition of place.
Example: Er war in Deutschland. He was in Germany.
in can be used in both the accusative and the dative case; it is a "two-way preposition". Since it is a two-way preposition, the main thing is to distinguish between both cases to determine whether you mean a "movement" (for accusative) or a "place" (for dative).
So, if you are talking about a movement or a change of place, you should use accusative. In this case, use in die/in den/ins = into the. This case is naturally used with into in English since it implies a movement.
If you are talking about a place or a fixed position, you should use dative and in this case use in der/im/im = in the.
When is "in <country name>" and when is "im <country name>" used?
You are undoubtedly already aware that "in" and "im" combined with country names do not follow any recognisable grammatical rule. For example, one says "in Deutschland", "in Russland", "in Somalia", but also "im Irak", "im Sudan", "im Kongo".
How does this happen?
It depends on which article the country has. The vast majority of states in the world have no article (that is the short story*). A few are feminine (die Schweiz), masculine (der Kongo) or are used with plural (die USA).
If you want to say you are someone is in the country, you use dative. If a state has an article, it is declined accordingly: in Deutschland (no article), in der Schweiz (feminine), im Kongo (masculine), in den USA (plural).
der Tschad → im Tschad (in Chad)
die Mongolei → in der Mongolei (Mongolia)