It’s honestly so helpful to remember your prefixes! Micro is 10^-6. You always give the prefix the 1, and your new base unit the power!
512 micrograms | 10^-6 grams
————————— ——————
1 microgram
Now that we have canceled our micrograms, we are left with 512 * 10^-6 grams. We move the decimal six times to the left since it is a negative exponent. That gives you:
0.000512 grams!! Using my conversion cheat will help even if you’re adding multiple things together (but remember your sigfigs).