user28583: How to convert the char array to Byte array? I tried every method but it doesn't work.
char CardNumber[8] = "B763AB23"; // Length is 8, basically it's in Hex
                                 // B7 63 AB 23

I need to convert it into Byte array to byte CardNumberByte[4];
So basically, it should be like :
CardNumberByte[0] = B7;
CardNumberByte[1] = 63;
CardNumberByte[2] = AB;
CardNumberByte[3] = 23;

I am unable to find any solution for that.

user30198: There are indeed many methods (and they all work if done right).
Is it always a lenght of 8 ? That means it is 32-bit unsigned long number.
The strtoul can convert it to a long. Use '16' for the base. If you need the seperate numbers, you can shift the unsigned long and convert to bytes or use a union.
It is also possible to do with a for statement can convert each character of the input to a value: forum.arduino.cc: convert HEX (ASCII) to a DEC int
[ADDED]
Thank you @goddland_16 for providing a full sketch. I could not stay behind and wrote a sketch with strtoul.
char *CardNumber = "B763AB23";
byte CardNumberByte[4];

void setup() 
{
  Serial.begin(9600);
  Serial.println("With strtoul");

  // Use 'nullptr' or 'NULL' for the second parameter.
  unsigned long number = strtoul( CardNumber, nullptr, 16);

  for(int i=3; i>=0; i--)    // start with lowest byte of number
  {
    CardNumberByte[i] = number & 0xFF;  // or: = byte( number);
    number >>= 8;            // get next byte into position
  }

  for(int i=0; i<4; i++)
  {
    Serial.print("0x");
    Serial.println(CardNumberByte[i], HEX);
  }
}

void loop() 
{
}


28583: <p>How to convert the char array to Byte array? I tried every method but it doesn't work.</p>

<pre><code>char CardNumber[8] = "B763AB23"; // Length is 8, basically it's in Hex
                                 // B7 63 AB 23
</code></pre>

<p>I need to convert it into Byte array to <code>byte CardNumberByte[4];</code>
So basically, it should be like :</p>

<pre><code>CardNumberByte[0] = B7;
CardNumberByte[1] = 63;
CardNumberByte[2] = AB;
CardNumberByte[3] = 23;
</code></pre>

<p>I am unable to find any solution for that.</p>
 30198: <p>There are indeed many methods (and they all work if done right).</p>

<p>Is it always a lenght of 8 ? That means it is 32-bit unsigned long number.
The strtoul can convert it to a long. Use '16' for the base. If you need the seperate numbers, you can shift the unsigned long and convert to bytes or use a union.</p>

<p>It is also possible to do with a for statement can convert each character of the input to a value: <a href="http://forum.arduino.cc/index.php?topic=45182.0" rel="nofollow noreferrer">forum.arduino.cc: convert HEX (ASCII) to a DEC int</a></p>

<p>[<strong>ADDED</strong>]<br>
Thank you @goddland_16 for providing a full sketch. I could not stay behind and wrote a sketch with strtoul.</p>

<pre><code>char *CardNumber = "B763AB23";
byte CardNumberByte[4];

void setup() 
{
  Serial.begin(9600);
  Serial.println("With strtoul");

  // Use 'nullptr' or 'NULL' for the second parameter.
  unsigned long number = strtoul( CardNumber, nullptr, 16);

  for(int i=3; i&gt;=0; i--)    // start with lowest byte of number
  {
    CardNumberByte[i] = number &amp; 0xFF;  // or: = byte( number);
    number &gt;&gt;= 8;            // get next byte into position
  }

  for(int i=0; i&lt;4; i++)
  {
    Serial.print("0x");
    Serial.println(CardNumberByte[i], HEX);
  }
}

void loop() 
{
}
</code></pre>
