I have 18-55mm lens on my nikon d3100 what size filter would i get?

Most places only sell 52 or 58 mm filters

The 18-55mm refers to the focal length of the lens.
A filter is based (roughly) on the diameter of the lens.
If this is your lens: AF-S DX NIKKOR 18-55mm f/3.5-5.6G VR
then you need a 52mm filter. If not, take the lens in with you to a store.
One big piece of advice. Do NOT buy filters that are inexpensive. Pay extra & get good, high quality filters such as Nikon's.eBay often carries them. The reason? A filter affects the quality of your pictures as much as the lens. Nikon makes good lenses, don't put a piece of crap in front of it.

You'd think that turning over the lens cap was common sense and knowledge by now.
Ah well, 52mm indeed.

You have to use the 52mm filter no other will fit.

This works for most lenses
Lift your camera.
Look at the front of the lens
You will see writing around the glass of the lens including a symbol like this Ø, followed by a number, for example 55. = Ø55
This is the size of filter you will need.
- What size filter to buy for Nikon 5100 camera for 55mm lens?
- What is the right UV filter size for Nikon d3200 18-55mm VR lens?
- What size of circular polarizer filter i can use for 18-55mm lens?
- I have the nikon D60 and want to buy a filter for my lens.what size?
- Would any lens hood from a 52mm filter size work on my nikkor 35mm f/1.8G?