According to the National Institute of Standards and Technology (NIST), the chemical formula of Styrofoam is C8H8. Styrofoam, the brand name of a type of polystyrene, contains equal parts carbon (C) and hydrogen (H). The manufacture of true polystyrene requires hazardous chemicals and equipment that should be used only in a supervised chemical lab. An imitation formula uses more readily available ingredients and can be made at home.
Dissolve 2 tsp. borax in 1/2 cup (4 oz.) water. Set aside.
In a separate bowl, mix 1/4 cup (2 oz.) Elmer’s Glue and 1/4 cup (2 oz.) water.
Pour Elmer's glue solution into air-tight, gallon-size bag.
Add 3 tbsp. of the borax/water solution to the Elmer's glue solution but do not mix.
Add the micro-beads and bean bag filler. Seal bag and knead until thoroughly mixed.
Let stand for 15 minutes then knead for a few more minutes. It should feel somewhat firm but still malleable.
Remove mixture from the bag and work it into desired shape. Let it dry for three to four hours.
Borax can be found in the laundry aisle at your grocery store. Micro-beads may be found at a craft store. Bean bag filler can be bought on eBay. 5/3 cups of polystyrene beads can be used in place of the micro-beads and bean bag filler. You can make an approximation of the beads by grating polystyrene cups.
Ingredients could cause harm if swallowed.