IPv4 to binary
A prefix length is simply a count of leading bits. A /26 fixes the first 26 bits and leaves 6 free, giving 64 addresses. In dotted-quad that boundary looks arbitrary: 255.255.255.192, but in binary it is obvious: 26 ones followed by 6 zeros. Every subnetting rule becomes clear once the address is written as bits, which is why it is always taught this way.
Each octet becomes eight bits, giving 32 in total. 10.20.30.40 is 00001010 00010100 00011110 00101000. Subnet prefixes count leading bits, which is why binary is the form subnetting is taught in.
How to convert an IP to binary
Reading the binary makes the private ranges recognisable. Anything starting 00001010 is 10.x, a whole /8. Anything starting 11000000 10101000 is 192.168.x. And 10101100 0001 followed by four variable bits is 172.16 to 172.31 — the range people misremember, because a /12 boundary falls inside the second octet rather than tidily between two.
A mask is just a count of leading ones. A /26 is 11111111 11111111 11111111 11000000, which in dotted quad is the arbitrary-looking 255.255.255.192. Two facts follow directly from the bits: AND the address with the mask and every host bit clears, giving the network address; set every host bit instead and you have the broadcast. Six free bits means 64 addresses, of which 62 are usable once those two are spoken for.
This converts an address and nothing more. It does not accept a /26 suffix, does not work out a network, broadcast or usable range, and does not judge whether the address is routable; the subnet calculator does all of that. What it gives you is the 32 bits, which is the form every subnetting rule is actually written in.
Questions
Thirty-two — four octets of eight bits each.
Twenty-four leading ones then eight zeros: 11111111 11111111 11111111 00000000, or 255.255.255.0.
AND the address with the mask. 10.20.30.40 under a /24 gives 10.20.30.0, because the last eight bits clear.
Not here: the suffix is not accepted. Convert the address, then count 26 bits along the binary, or use the subnet calculator.
Because the prefix is /12, and the boundary falls inside the second octet rather than on it.
Sixty-four, since six bits are left free. Usable hosts are 62 after the network and broadcast addresses.
The principle is identical, but with 128 bits written in hexadecimal groups.