Can US Border Control Check Your Phone?
Borders and ports of entry, including airports, are extremely sensitive areas. On the one hand, they're entry points for trade, commerce, legal immigration, and tourism; on the other hand, they could be a source of drugs, prohibited substances, criminals, and terrorists. The issue is separating the legal from the illegal, and the U.S. Customs and Border Protection — AKA Border Control or CBP — has the tough task of discerning the two.
Border agents employ certain authority and assumptions to do their jobs effectively. One of them is the law of presumption, where a citizen is presumed to be an alien until identified, and an alien is treated as an immigrant until properly classified. Because of these presumptions and security concerns, ports of entry have a looser enforcement of the Fourth Amendment. Going by the Immigration and Nationality Act, 8 U.S.C. § 1357(c), CBP officers "shall have power to conduct a search, without warrant, of the person, and of the personal effects in the possession of any person seeking admission to the United States." So while you don't have to worry about the TSA checking your phone, CBP officers have the absolute right to search your phone, laptop, or any electronic devices on your person. There aren't any real exceptions either, except for those under diplomatic immunity.
Border Control doesn't need a reason to search your phone
Searches at U.S. borders fall under what's known as the "border search exception" to the Fourth Amendment, allowing Customs and Border Protection (CBP) officers to search belongings, including electronic devices, without a warrant or probable cause. This includes international airports and other ports of entry, with these searches considered administrative rather than criminal.
In 2017, American NASA engineer Sidd Bikkannavar was directed to hand over his government-issued phone when held by Homeland Security at Houston Airport. When asked why he was singled out, there wasn't any straightforward answer. Eventually, this led to a lawsuit, Alasaad v. McAleenan, where the District Court ruled that suspicionless phone searches violated the Fourth Amendment. The First Circuit reversed that decision in 2021 and ruled that reasonable suspicion isn't required to search phones at the border. Advanced searches (involving forensic tools or data copying) need reasonable suspicion, but not probable cause. This means that there doesn't even have to be any reason at all; you can be singled out and searched for any reason a border agent deems fit.
One defense you may have as a U.S. citizen is to withhold your password. After all, you do have a right to remain silent. However, going by CBP Directive No. 3340-049A: Border Search of Electronic Devices, the questioning officer can choose to detain the device instead. If you have nothing to hide, it's probably best to cooperate. As for non-citizen visa holders, refusing to provide a passcode could cause you to be denied admission into the United States altogether.