Upvote:4
The most common stamp for visa-free visitors is code 5n, issued when a stay of up to 6 months (the maximum) is granted and there are no particular suspicions about the entrant. The former landing cards would then be discarded.
Then there's code 3, issued when, for example, there are suspicions about the entrant (insufficient to refuse entry), when a visa national transits landside at an airport, or for visa-free short-term students. Known as a recorded landing, it used to involve retaining the landing card and writing the landing card number on a rectangular stamp. I honestly don't know how it's done now.
The rectangular stamp is also issued for non-recorded landings when a maximum stay of less than 6 months is granted.
Finally, visa holders and UK residents will normally receive an open date stamp, i.e. only the square stamp with the date and port of entry.