# How do we calculate rarities?

The Hyperspace.xyz rarity scoring and rank methodology

### Introduction

First off, we have to give credit to rarity.tools and others for doing groundwork and sharing their methodologies for calculating rarities. We follow a similar approach with some of our own additional checks to ensure accuracy. It's important to note that this is a formulaic approach to provide our users with easy heuristics while browsing, and may differ from other rarity sites, or from the rarities that a project creator officially decides best fits the collection.
If you want to chat more about our approach or rarities for a specific project, join us on Discord.

### Rarity Scoring Methodology

• NFT metadata will typically be in the format of: {Attribute: Trait}
• The Degod below has {Head: Medusa}, {Eyes: Steampunk Goggles}, {Skin: Nebula}, etc.
• NFTs in a collection generally won't always explicitly have a trait value for a given attribute, in which case we assign a value of None
• {Specialty: None} in the screenshot below
So once we've figured out the attributes / traits for every NFT, we now know what this entire collection or population of NFTs looks like and can figure out its demographics.
What we want to know is how prevalent is every trait in a collection which we can calculate as:
$Trait\ Popularity = {\dfrac{Number\ of\ items\ with\ that\ trait}{Collection\ Size}}$
And we can turn this into a rarity score for each trait by just taking the inverse:
$Trait\ Rarity\ Score = {\dfrac{1}{Trait\ Popularity}}$
Let’s go through a quick example with one of the traits from Degod #3251 above.
• There are 10,000 Degods in total, 54 of which have Nebula Skin
• The trait popularity for Nebula Skin is therefore
${\dfrac{54}{10,000}}=0.54\%$
• To turn this into a rarity score, we then take
${\dfrac{1}{0.54\%}}=185.185$
We can do this for every trait in the collection and then add up the rarity scores of each NFT’s corresponding traits.
Attribute
Trait
Trait Popularity
Rarity Score
Eyes
Steampunk Goggles
1.97%
50.761
Medusa
0.25%
400
Neck
Gold Chain
4.11%
24.330
Skin
Nebula
0.54%
185.185
Mouth
None
57.31%
1.744
Clothes
DeDoctor Coat
3.20%
31.25
Specialty
None
54.25%
1.843
Background
Heaven
1.24%
80.645
Total Score
775.760
Once we sum up the rarity score for every NFT in the collection, we sort these from highest to lowest rarity score and stack rank. The token with the highest rarity score will be rank #1, the next highest rarity score will be #2 and so on.
In the cases where multiple NFTs have the same rarity score, they will have the same rank and the lower ranked NFTs will be pushed down accordingly.

#### Example with tied rarity scores

ID
Rarity Score
Rank
NFT A
100
1
NFT B
100
1
NFT C
50
3
In the Cets on Crack collection, the top seven ranked Cets are equally rare sharing Rank 1. The second rarest score is then Rank 8.

### Nuances

• We exclude numeric ranges from rarity scoring
• We define numeric ranges as any attribute category where all the possible values are numeric and there are more than 20 possible values. This will be most commonly found in algorithmically generated art collections
• We do not update rarities when NFTs are burned or added to a collection
• Some collections continuously add or burn NFTs from their collection over time. Degods and Pesky Penguins have well-know deflationary burn mechanisms, while collections like STEPN are increasing their supply over time by minting or adding new NFTs to the collection