Lemon juice and lime juice can each provide an acidic element and a bit of zest to recipes, both in cooking and in baking. If you don't have one on hand, it's usually just fine to substitute the other.
Substitutes for Lemon Juice
Lime juice can be substituted for lemon juice tablespoon for tablespoon in all recipes. Lime juice is more acidic than lemon juice and has a stronger flavour. Lime zest (the gratings of the lime rind) can also be substituted for lemon zest. If you are just using the citrus juice to keep fruit from discolouring, you can even substitute crushed vitamin C tablets in water.
Substitutes for Lime Juice
Lemon juice can be substituted for lime juice tablespoon for tablespoon. If you need larger quantities of lime juice for your recipe, 1 cup of lemon juice substitutes for 3/4 cup of lime juice. Orange juice is also a suitable substitute for lime juice, and passion fruit juice or sweetened lime juice can substitute for key lime juice.
Vinegar as a Substitute
Depending on the flavour needed, you can sometimes substitute 1/2 tbs. vinegar or 1 tbs. of wine for 1 tbs. of lemon juice or lime juice, although you won't want to do this in baking.