There are gas caps for almost everything that uses or carries gasoline — from your automobile and lawn mower to the gas can you fill up when you run out of gas. Sometimes the gas cap can become broken or lost and you need to find a replacement or else gasoline can leak out or evaporate. Replacing a gas cap with a homemade version should only be done as a stop-gap measure until you can find a match via an auto or lawnmower dealer.
Measure the dimensions of the old gas cap if you still have it or where the gas cap screws in if you don't have the actual cap. This gives you an idea of exactly the size of cap that you are going to need for the gas cap.
Search around to see if you have any old gas cans lying around that may replace a gas can cap. If you have one that is a similar size and type, then that cap likely fits the missing cap. With a gas can, the cap doesn't have to fit perfectly and can be loose. Secure it with duct tape.
Place an old rag into the gas tank of your automobile, so something is covering the hole where the gas goes into. It isn't perfect, but it will keep particulates from entering the gas tank. The fuel system is a sealed system, so it may cause the check engine light to go on, but it will not harm the car.
Visit a junkyard to search for a similar make and model car. Use the dimensions measurements to guesstimate if the gas tanks available will fit your car or at least cover the tank and keep particulates from getting in the tank. Secure the cap with duct tape if it doesn't fit perfectly or is loose.