A method for real-time compression of a data frame, the method comprises: receiving, by a processor, a data frame, wherein the data frame corresponds to a sequence of uncompressed symbols from a set of symbols, wherein the length of each symbol is m bits; identifying, by the processor, a frequency associated with each symbol, from the set of symbols, wherein for each symbol, the frequency corresponds to a number of occurrence of the symbol in the data frame; sorting, by the processor, the set of symbols to generate a sorted set of symbols, based on descending order of frequency associated with each symbol from the set of symbols; computing, by the processor, a compression gain associated with each predefined case type, from a set of predefined case types, wherein each predefined case type corresponds to a number of bits C used for representing first 2^C-1 symbols from the sorted set of symbols; comparing, by the processor, the compression gain associated with each predefined case type from the set of predefined case types; selecting, by the processor, a target predefined case type, from the set of predefined case types, that corresponds to maximum compression gain achieved as compared to other predefined case types, wherein the target predefined case type corresponds to Ct bits; assigning, by the processor, Ct bits compressed code to the first 2^Ct-1 symbols, from the sorted set of symbols, and m+Ct bits code to the remaining symbols from the sorted list of symbols, wherein for each remaining symbol from the sorted list of symbols, the Ct initial bits indicate that the symbol is uncompressed and the remaining m bits represent the value of the uncompressed symbol; and generating, by the processor, a compressed frame, wherein the compressed frame comprises a header and a sequence of compressed symbols, wherein the sequence of compressed symbols is generated based on the bit code assigned to each symbol, wherein the sequence of compressed symbols represents the compressed code of the first 2^Ct-1 symbols and the code of the remaining symbols, and wherein the header represents the target predefined case type, and the first 2^Ct-1 symbols. receiving, by a processor, a data frame, wherein the data frame corresponds to a sequence of uncompressed symbols from a set of symbols, wherein the length of each symbol is m bits; identifying, by the processor, a frequency associated with each symbol, from the set of symbols, wherein for each symbol, the frequency corresponds to a number of occurrence of the symbol in the data frame; sorting, by the processor, the set of symbols to generate a sorted set of symbols, based on descending order of frequency associated with each symbol from the set of symbols; computing, by the processor, a compression gain associated with each predefined case type, from a set of predefined case types, wherein each predefined case type corresponds to a number of bits C used for representing first 2^C-1 symbols from the sorted set of symbols; comparing, by the processor, the compression gain associated with each predefined case type from the set of predefined case types; selecting, by the processor, a target predefined case type, from the set of predefined case types, that corresponds to maximum compression gain achieved as compared to other predefined case types, wherein the target predefined case type corresponds to Ct bits; assigning, by the processor, Ct bits compressed code to the first 2^Ct-1 symbols, from the sorted set of symbols, and m+Ct bits code to the remaining symbols from the sorted list of symbols, wherein for each remaining symbol from the sorted list of symbols, the Ct initial bits indicate that the symbol is uncompressed and the remaining m bits represent the value of the uncompressed symbol; and generating, by the processor, a compressed frame, wherein the compressed frame comprises a header and a sequence of compressed symbols, wherein the sequence of compressed symbols is generated based on the bit code assigned to each symbol, wherein the sequence of compressed symbols represents the compressed code of the first 2^Ct-1 symbols and the code of the remaining symbols, and wherein the header represents the target predefined case type, and the first 2^Ct-1 symbols.