A memory device and an operating method of operating the memory device are provided. The method includes: obtaining, by a
memory controller, channel selection information indicating positions of
data bits and shaping parity bits; generating, by the
memory controller, an alignment vector by aligning the
data bits and the shaped parity bits having an arbitrary value based on the channel selection information; generating, by the
memory controller, second LLR information of the target vector based on the first LLR information related to the alignment vector; determining, by the memory controller, a value of a shaped parity based on the target vector and the second LLR information; performing, by the memory controller, an update operation on the shaped parity based on the determined value; and generating, by the memory controller after performing the update operation, a codeword with respect to the input data based on a first
matrix multiplication calculation of the target vector and the first generated matrix.