Generally by its size, length of barrel, what type of barrel it is, what sort of firing mechanism it has and how does it load and feed ammunition.
It is also usually stamped directly into the metal somewhere on the frame.
Chat with our AI personalities