The invention relates to a capsule intended for delivering a beverage in a beverage preparation machine. The capsule comprises a code support surface on which a code is represented. The code comprises a first value for at least one capsule-related information. The code further comprises a first element and a second element arranged on the code support surface so as that the distance between the first element and the second element is a function of the first value.