I've been finding myself quite confused about a particular situation. So I know that people say a key to (physical place), such as ''do you have the key to the shed'' etc. However, I'm not sure what to say where there's no key involved but a codelock. Should I say: ''do you have the code to the lab'' or ''do you have the code for the lab''?

I'd think the former makes more sense as the code is what allows you to get through the door, into the lab. But I might be wrong, hence me asking on here.

Thank you for your help

  • 1
    There are many acceptable ways to say this: the code for the lab keypad; the code for the lab, or even, the lab code. – Lambie Jun 1 '18 at 15:54
  • 2
    Please include the research you’ve done. Questions that can be answered using commonly-available references are off-topic. Reasonable research should always be presented.... – Edwin Ashworth Jun 1 '18 at 17:10
  • 1
    These Google Ngrams seem to indicate that 'code for the door / code to the door' are both valid options, with 'for' the preferred version. The Ngram for 'key to the door' swamps these results. – Edwin Ashworth Jun 1 '18 at 17:11
  • Either one is OK: "...the code to the lab" or "...the code for the lab". My preference would be "...the code for the lab". – tautophile Jun 1 '18 at 17:59
  • I'd use "the code to get into the lab". Just "code for" might imply a WiFi network or something else. – Wayfaring Stranger Jan 1 '19 at 1:42

In the circumstances you describe both "key to" and "key for" are acceptable.

Likewise both "code for" and "code to" are acceptable.

  • 2
    We're looking for answers that provide some explanation and context. Please explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed. – David Jun 1 '18 at 22:02

The difference is tone and formality: in spoken American English, some people will definitely say to a friend, "Have you got the key to the storage shed?" But in my experience, at any higher level of formality, key for is more "correct" sounding and common.

But I think it's common to flip the expression around and avoid the preposition:

...the shed key...


I lost my car keys again.

That last one is super preferred in that situation. You probably wouldn't say "keys to my car," unless you're clarifying between the car and something thing else. And when it involves a "key pad" and not a physical key, we've got both on our apartment door. So we have conversations that go like:

I forgot our apartment key code.

Your example is interesting:

Do you have the key to the shed?

That's a fine sentence, written or spoken. But it has a certain connotation to me, as a US English speaker: it's not "neutral". It sounds like the speaker has lost the key and is looking for it ... and probably suspects me of using it and not putting it back where it belongs. :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.