Can you take a selfie?
There's nothing in the law that specifically bans taking photos, but the Electoral Commission very strongly discourages any photography inside a polling station, primarily because of complex laws about maintaining the secrecy of the ballot. For instance, it's illegal to reveal how someone else has voted, which could happen inadvertently via a sloppy selfie. In addition, taking a photo of a ballot paper's unique identification number is against the rules. The key is a law against releasing any information "obtained in a polling station", which is in order to protect the integrity of the poll.
The Electoral Commission says: "Due to the potential breach of the law, intentionally or not, we strongly advise against any form of photography taken inside a polling station. However, if a voter would like to highlight their participation in the elections, we suggest this is done outside the polling station before or after they vote." Consequently, you will see "no photography" signs inside many polling stations.
There are strict penalties for breaches of the law. At the European elections last year people were warned that they could face a fine of £5,000 or six months in prison if they revealed how someone else voted, even accidentally. In practice, election staff might ask anyone taking a picture to delete it rather than go straight to the police. "It would depend on exactly what they were taking a photograph of," one electoral services manager says.
Can you tweet about voting?
The Electoral Commission warns against doing it inside the polling station, even if it's about your own vote. Elsewhere you are free to publicise your vote. However, as above, there are strict laws against revealing someone else's vote, including influencing whether they publish it themselves. Under Section 66 of the Representation of the People's Act it is a criminal offence to communicate information about the way someone has voted or is about to vote, and specifically to "directly or indirectly induce a voter to display his ballot paper after he has marked it so as to make known to any person the name of the candidate for whom he has or has not voted".