Abstract.Recently, linear codes with complementary dual (LCD codes) are employed in direct-sum-masking technique for prevention of side channel attacks, which is another application on LCD codes out of data storage, communication system and consumer electronics. Follow on, they are also used to construct maximal entanglement entanglement-assisted quantum codes for protecting quantum information from noise. In this paper, by transforming known codes, some optimal LCD codes of short length with dimension 3 or 4 over 5 F are constructed, respectively.