Device configured to emboss a code in a substrate, the device comprising: - a first embossing element and a second embossing element between which a passage for conveying the substrate is defined, the passage including an embossing area where the first embossing element and the second embossing element interact to emboss a code in the substrate during operation of the device, the first embossing element comprising a set of studs (8a, 8b, 8c, 8d) and the second embossing element being provided with a corresponding set of recesses (9a, 9b, 9c, 9d), each stud of the set of studs (8a, 8b, 8c, 8d) being configured and arranged to be movable between an extended position in which embossing a code element in the substrate is enabled and a retracted position in which embossing a code element in the substrate is prevented; and - a setting unit configured to put studs of a respective subset (13a, 13b, 13c, 13d) of the set of studs (8a, 8b, 8c, 8d) to one of the extended position and the retracted position, the setting unit including: - a manipulating mechanism configured to manipulate at least one stud of the respective subset (13a, 13b, 13c, 13d); and - a controller configured to process information relating to a predetermined position pattern of the studs of the respective subset (13a, 13b, 13c, 13d) and to control operation of the manipulating mechanism based on said information; characterized in that the first embossing element and the manipulating mechanism are movably arranged with respect to each other so that the manipulating mechanism is capable of successively covering subsets (13a, 13b, 13c, 13d) of the set of studs (8a, 8b, 8c, 8d). - a first embossing element and a second embossing element between which a passage for conveying the substrate is defined, the passage including an embossing area where the first embossing element and the second embossing element interact to emboss a code in the substrate during operation of the device, the first embossing element comprising a set of studs (8a, 8b, 8c, 8d) and the second embossing element being provided with a corresponding set of recesses (9a, 9b, 9c, 9d), each stud of the set of studs (8a, 8b, 8c, 8d) being configured and arranged to be movable between an extended position in which embossing a code element in the substrate is enabled and a retracted position in which embossing a code element in the substrate is prevented; and - a setting unit configured to put studs of a respective subset (13a, 13b, 13c, 13d) of the set of studs (8a, 8b, 8c, 8d) to one of the extended position and the retracted position, the setting unit including: - a manipulating mechanism configured to manipulate at least one stud of the respective subset (13a, 13b, 13c, 13d); and - a controller configured to process information relating to a predetermined position pattern of the studs of the respective subset (13a, 13b, 13c, 13d) and to control operation of the manipulating mechanism based on said information; - a manipulating mechanism configured to manipulate at least one stud of the respective subset (13a, 13b, 13c, 13d); and - a controller configured to process information relating to a predetermined position pattern of the studs of the respective subset (13a, 13b, 13c, 13d) and to control operation of the manipulating mechanism based on said information;