Summarize this article:

You will have three numbers to use in your calculation. For example, say that Joe Smith plays for 6 innings in a 9-inning game and allows 3 men to score. For this, divide the number of earned runs by the number of innings played. Following our example, it would be 3/6, giving us the number .5. That means we would take our number of .5 and multiply it with 9, giving us 4.5. Depending on your preference, you can calculate ERA two ways. The first (shown above) is ERA= total innings(earned runs / innings pitched). You can also formulate it as ERA = earned runs x total number of innings / innings pitched. Test your answer using the alternate method.
Gather your information. Make the first calculation. Multiply this number with the total number of innings. Test your number.