  Linear complementary dual (LCD) codes are linear codes that intersect with
their dual trivially. We give a characterization of LCD codes over
$\mathbb{F}_q$ having large minimum weights for $q \in \{2,3\}$. Using the
characterization, we determine the largest minimum weights among LCD $[n,k]$
codes over $\mathbb{F}_q$ for $(q,k) \in \{(2,4), (3,2),(3,3)\}$. Moreover, we
give a complete classification of optimal LCD $[n,k]$ codes over $\mathbb{F}_q$
for $(q,k) \in \{(2,3), (2,4), (3,2),(3,3)\}$.
