Serial.Read() echoing back an extra value.

Here's my code

const int led = 4;

void setup(){
pinMode(led, OUTPUT);
Serial.begin(9600);
}

void loop(){
while(Serial.available() == 0);

int k = Serial.read() - '0';
Serial.println(k);

if(k == 1){
digitalWrite(led, HIGH);
}
else if (k == 0){
digitalWrite(led, LOW);
}

}

For some reason whenever I put in a value it returns two, the value I gave it and then -38 in the next line. This is why I have no else block, because it is always triggered immediately. The code works right now, but it won't when it comes to actually taking specific values for calculations.

Does anyone know why this happens and what I can do to fix it? I'm using an elegoo uno r3 if that could be it.

This is the shortest failing code posted.
Spend some time Reading about "Serial", Serial.read….
Link:

You have line endings in the serial monitor set to Newline so when you send '1', what is actually sent is 2 bytes: 0x31 ('1'),0x0a ('\n') (or decimal 49, 10). The -38 is 10 - 48 or '\n' - '0'. Turn off line endings and the -38 will go away.

line ending.jpg

line ending.jpg