How to convert a hexadecimal number to an octal number? How can I convert a hexadecimal number, for example 0x1A03 to its octal value?
I know that one way is to convert it to decimal and then convert it to octal
0x1A03 = 6659 = 0o15003



*

*Is there a simple way to do it without the middle step (conversion to decimal or conversion to binary)?

*Why do we tend to convert it to Base10 every time?

There's a fast procedure involving no intermediate representation.  You need only four lookup tables totaling 544 entries.
Earlier answers have established that the conversion can be done in blocks of 3 (working right to left).  Consider the rightmost block in your example:
0xA03 = 1010 0000 0011 B
You need to break this binary string into four groups of three bits, which I will number 1, 2, 3, 4 from the right to the left:
1: 011 B
2: 000 B
3: 000 B
4: 101 B
The first depends only on the rightmost hex digit 0x3.  The second depends only on the two rightmost digits 0x03 (it gets its rightmost bit from the 0x3 and its first two bits from 0x0).  The third depends only on the second and third digits 0xA0.  The fourth depends only on the third digit 0xA.  Whence, you only need to perform the following conversions, each of which can be stored in its own static lookup table:
1: 0x3 --> 03 [16 entries cover all possibilities]
2: (0x0, 0x3) --> 00 [16 * 16 entries]
3: (0xA, 0x0) --> 00 [16 * 16 entries]
4: 0xA --> 5 [16 entries].
Now you repeat with the next block, padding with zeros on the left as needed.  Continuing the example, the next block is 0x001:
1: 0x1 --> 01
2: (0x0, 0x1) --> 00.
You can stop here because all the original input has been consumed.  The output, working backwards, is 0015003.
This directly answers both parts of the original question: it provides a simple conversion without the middle step and it avoids base 10 (which is rarely used for computer conversion anyway: usually the job is done with bit shifting and masking, essentially a binary operation).  In case this procedure still looks too much like the other proposed solutions, please note that it performs absolutely no arithmetic (apart from decrementing pointers to input and output as it proceeds): it takes a string representation (hex) as its input, uses the characters to index its tables, and outputs an octal string.
