In which cases is a comma/period placed inside or outside of parentheses?

The Penguin Handbook says it more clearly than I could:1

  1. Examine the material enclosed by parentheses. Is it an entire sentence? If so, place the period inside the closing parenthesis.
  2. If the parenthetical material is part of another sentence, place the period outside the closing parenthesis.
  3. Sometimes the parenthetical material is part of a longer sentence part that will be set off by a comma, colon, or semicolon. These pieces of punctuation always come after the parenthetical material, never before it or inside the parentheses.

See also Brians's Common Errors and Wikipedia.

 
1Except that my examples were going to involve monkeys and saxophones. Theirs are pretty boring.


From the Guardian style guide:

parentheses

If the sentence is logically and grammatically complete without the information contained within the parentheses (round brackets), the punctuation stays outside the brackets.

(A complete sentence that stands alone in parentheses starts with a capital letter and ends with a stop.)


If what is enclosed in the brackets is a complete sentence, it makes sense to put the full stop inside the sentence too. (Here’s an example.) If the bracketed words form part of a sentence that is not itself bracketed, then there is no reason not to put the full stop where it would go anyway, at the end of the sentence (like this).