Choosing a proper shallot substitute depends a great deal upon the application in which you are using it. In general, shallots have a flavor that is fairly unique, though it may rather accurately be described as a combination of an onion and garlic, while being milder than either one. The most common shallot substitute is a mixture of minced garlic and onion in a ratio of about two parts onion to one part garlic. Different sorts of onions can be used for this, though sweeter types, such as red and yellow varieties, are typically preferred for a flavor that more closely resembles shallots.
A shallot is a root vegetable that is part of the same general family as onions; they are quite small and grow in multiple bulbs much like garlic. This gives them a visual appearance that resembles a strange combination of an onion and a bulb of garlic. Although they are quite a bit like both onions and garlic, neither of these ingredients alone is appropriate as a shallot substitute, since the flavor of each one is slightly different.
The best shallot substitute is generally considered to be a combination of both onion and garlic, which fairly well mimics the unique flavor of shallots. If both of these are not available, then just one alone can be used as a replacement. You should be cautious, however, with a dish that already includes onion or garlic and shallot, and the shallot substitute can simply be left out. This is not ideal and the flavor will not be perfect, but adding more of onions or garlic to a dish often simply creates overpowering flavor. Varying amounts of each ingredient can be used as a shallot substitute, though the simplest way to combine them is two parts of finely minced onion for one part of minced garlic.
The type of onion used as a shallot substitute can have a tremendous impact on how well the combination works. White onions, which are usually pretty acrid and harsh, are typically too strong in flavor to work well, since shallots are quite sweet and mild. Yellow varieties, such as Spanish onions, and those that are red in color usually work best due to their natural sweetness. Green or spring onions, sometimes also called scallions, can also be a shallot substitute, though the white end, rather than the green, should be used.