Take the 2-minute tour ×

The phrase "sanity check" comes up often in programming, e.g.

It's a good sanity check before attempting to decrypt the key.

Usually, its context is one in which a commonly assumed state (e.g. no memory corruption) is being tested, explicitly. For a long time, I interpreted "sanity" as the state opposed to "insanity", e.g.

It's a good check to make sure we don't lose our minds before attempting to decrypt the key.

Because of the many instances I'd spent hours, or days, debugging a mysterious bug, only to find the cause to be some uncommon state in the environment or data, this interpretation made sense to me; a sanity check would have saved my sanity.

Then one fateful day I perceived that "sanity" had a more canonical meaning: cleanness, e.g.

It's a good check for cleanness before attempting to decrypt the key.

Which is the interpretation meant by the phrase, "sanity check"?

I can go on using the phrase without knowing, since both interpretations fit the usual situations that call for it. But I'm curious to know, and I'm afraid emailing my coworkers a poll about their interpretations might cause them to question my sanity.

share|improve this question
To make a sanity check is just a quirky idiomatic way of saying make sure what we're doing (or what we're looking at) isn't completely insane/ridiculous/obviously stupid. It's not a direct reference to the sanity of the speaker (or his audience). –  FumbleFingers Dec 20 '12 at 19:05
@FumbleFingers - Ah, yes, that's a much better wording for the interpretation I held for a long time. I'm still not convinced though. Could "sanity" in that phrase actually have meant "cleanness" when it was first used, but due to the word "sanity" being more popularly recognized as the opposite of "insanity", adopted a new meaning? –  Andrew Cheong Dec 20 '12 at 19:12
It means a check that we or the situation are not insane. For example an "assert" is a form of sanity check. –  MετάEd Dec 20 '12 at 19:16
@acheong87: I personally wouldn't use "sanity check" to refer to basic validation of input parameter formats, for example. But if it was in the context of, say, an input form for a car insurance quote, asking for the applicant's Date of Birth, I might call it a "sanity check" to make sure the value input didn't imply the applicant was over 120 years old! –  FumbleFingers Dec 20 '12 at 19:17
When you get a working definition of sanity, please send it to the U.S. Congress. They're the ones who could benefit most. –  Robusto Dec 20 '12 at 19:36

1 Answer 1

up vote 3 down vote accepted

I refer you to dictionary.com, where it states (eventually):


  1. reason, rationality, sensibleness, reasonableness.

(emphasis added.)

A sanity check is simply a test to confirm that we are asking, or being asked for, something that is within some defined bounds of reasonableness.

share|improve this answer
Ah, I see. It seems the word "sanity" doesn't have anything to do with cleanness or pureness. I had always believed it did, thinking it to be a root of the word "sanitation". But it appears that that was exactly the culprit, looking at the etymology of "sanitation". –  Andrew Cheong Dec 20 '12 at 19:23
@acheong87 But it does. The Latin sanus, which is the distant root of both words, means healthy. –  Andrew Leach Dec 20 '12 at 19:49
@AndrewLeach - Yes, but I guess what I meant is that I inferred the meaning of "sanity" from "sanitation", which I incorrectly believed to mean "cleanliness" to begin with (as opposed to something to do with health). Had I had my premises straight and understood that sanus means healthy, as you point out, I probably wouldn't have had this confusion. –  Andrew Cheong Dec 20 '12 at 19:52

Your Answer


