I recently wrote an article on police searches of cell phones that was published on the LTN website. It focused on whether the police can search the contents of a cell phone when they arrest someone — even for a minor traffic offense.
One of the commenters asked an excellent question: "What if you need a passcode to enter your cellphone and refuse to provide it to the police to search the phone?"
The answer depends on whether the Fifth Amendment privilege against self-incrimination protects a person from being compelled to provide the passcode. The Fifth Amendment prevents the government from forcing a person to make any statements that can be incriminating.
Restating: in order for the Fifth Amendment to apply, there must be a (1) statement that is (2) incriminating.
Many things that incriminating are not statements. For example, fingerprints and handwriting samples are considered to be physical evidence, and not statements. Thus, they are not covered by the Fifth Amendment. This is why the government can compel people to provide handwriting fingerprints and handwriting examplars without a warrant. In contrast, providing a password is a statement, and it can be incriminating. This is because if you provide a passcode, you are admitting that you own or have access to the cell phone.
However, the police may still be able to force you to provide the password by convincing a judge that they don't need to use the fact that you knew the password to establish that you own or have access to the device. This is what happened in a recent case, In re: Grand Juery Subpoena to Sebastien Bourcher, where a defendant faced child pornography charges. The government obtained a warrant to search the defendant's laptop (which had been seized at a border crossing), but could not examine the contents without the defendant's password. The defendant refused a grand jury subpoena to supply the password. The court determined that the suspect had to provide the password. The court concluded that the Fifth Amendment did not apply. Providing the password, in this instance, added "little or nothing to the" case because the prosecution could prove that the suspect owned or possessed the computer "without making use of his production of" the password.
So, to answer the question, if you are arrested and refuse to provide the passcode to a cell phone (in a jurisdiction where a search of the contents of the cell phone is permitted incident to arrest), the police can seek a court order compelling you to provide the information. Except in cases where the ownership or access to the device is in question, the court will most likely order you to provide this information.