Skip to main content

How do Dreamwidth posts IDs work?

They were deliberately non-sequential as an anti-spam technique. It’s no longer required, but it’s in the codebase now and hasn’t been changed since it was written.

Dreamwidth IDs (posts, comments) don’t increment one-by-one, but via algebraic manipulations. Comments don’t go 1, 2, 3, they go 256, 540, 721, whatever.

The exact pattern is something like:

display_id = collection_id * 256 + internal_id

This is an old anti-bot measure: if a bot saw URLs with /1.html, /2.html, /3.html, it assumes it’s a sequence and continues in progression, which could overwhelm the site. These days it’s not needed (hooray CDNs!) but it’s baked into the site now.