The structure of cobalt substituted YBa2Cu3-xCoxO7±z compounds with x=0.05, 0.1, 0.2, 0.3 and 0.65 was determined by high-resolution neutron powder diffraction at 5 and 300 K. The samples are superconducting up to x=0.3. YBa2Cu2.95Co0.05O7 has orthorhombic structure with space group Pmmm; all compounds with x≥0.1 have tetragonal structure with space group P4/mmm. The Rietveld refinements show clearly that the Co-atoms occupy only the Cu(1)-sites at (0, 0, 0), i.e. copper chain sites in the orthorhombic structure, for the whole composition range. The characteristic structural changes as a function of cobalt concentration and temperature are discussed. Along the c-axis the Cu(1) to O(2) distance is decreasing while the Cu(2) to O(2) distance is increasing as in the Co-free, oxygen deficient compounds. A charge transfer from the Cu/Co chains to the Cu planes is discussed. For the nonsuperconducting YBa2Cu2.35Co0.65O7.23 some magnetic peaks are observed.