Facemash algorithm: how the Elo rating ranked photos
Codemia Knowledge Hub ·
Facemash ranked photos with a formula that resembles the Elo rating system used in chess: every photo has a rating, each vote is treated as a match between two photos, and the winner takes points from the loser, more of them when the result is an upset. Mark Zuckerberg built the site in 2003 as a Harvard sophomore, before Facebook existed. It showed two student photos side by side and asked users to vote on who was "hotter."
How the rating works
- Initialization: each photo starts with a median number of points, possibly 1400 to match a common Elo starting value.
- Comparison and voting: • Two photos appear side by side. • A user votes for the "hotter" one.
- Score adjustment: • Both photos' scores are adjusted after the vote. • If the higher-ranked photo wins, both scores change slightly. • If the lower-ranked photo wins, it gains more points and the other loses more.
A simplified form of the Elo calculation:
Where: • is the expected score of photo A. • and are the current ratings of photos A and B.
The new ratings and are:
and are the actual scores (1 for a win, 0 for a loss, 0.5 for a tie), and is a constant that sets how much one result counts, often 32.
Worked example
Two photos, A and B: • Initial ratings: , • The user votes for A.
Expected scores: • ,
After A wins: • •
A gains 16 points and B loses 16, reflecting the vote.
Technical strengths and ethical problems
- Simplicity: ranking algorithms like this are simple, versatile and efficient.
- Scalability: the approach keeps working as more photos are added.
- Ethics: ranking people by appearance raises serious concerns, and the site drew a strong backlash over privacy and the objectification of students.
- Engagement data: Facemash was an early example of using social data to drive engagement, a precursor to later social media algorithms.
- Privacy: it used photos without permission, which led to Harvard taking disciplinary action against Zuckerberg.
Key points
| Feature | Explanation |
| Algorithm Type | Comparison-based; resembles Elo rating system |
| Initial Rating | 1400 points for each photo (or standard initial rating) |
| Rating Adjustment | Based on user votes and expected results |
| Expected Outcome | Calculates likelihood of each photo being preferred |
| Benefits | Simple, scalable for numerous data points |
| Ethical Concerns | Objectification and privacy issues with unsanctioned photographs |
| Legacy | Early exploration in data-driven social interaction algorithms |
Related reading
- Factorial-time algorithms and P/NP
- Factorial Algorithms in different languages
- Factorial of a large number in python
- Factoring a number into roughly equal factors
- Factoring a quantum state
- Failed to get convolution algorithm. This is probably because cuDNN failed to initialize,
- False Sharing in Hogwild Algorithms
- Family Tree Algorithm

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.