используй абсолютное позиционирование
.icon{
position: relative;
width: 40px;
height: 40px;
text-align: center;
}
.icon svg{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: inline-block;
width: 25px;
height: 25px;
}