The invention relates to a marking device for applying a code marking on a piece of wood. The marking device comprises several adjustable marking members, each of which comprising a marking element which is capable of applying a mark on a piece of wood and which is shiftable between different positions or states so as to allow a variation of the code marking to be applied by the marking device. At least one of said marking members (170) comprises a rotatable marking element (171), which is arranged to apply a rotationally unsymmetrical mark on a piece of wood and which is settable in different rotational positions in relation to the marking elements of the other marking members. The invention also relates to a harvesting arrangement for tree harvesting comprising such a marking device.