We propose a method to produce pure single photons with an arbitrary designed temporal shape in a heralded, lossless and scalable way. As the indispensable resource, the method uses pairs of time-energy entangled photons. To accomplish the shaping, one photon of a pair undergoes temporal modulation according to the desired shape. Subsequent frequency-resolving detection of the photon heralds its entangled counterpart in a pure quantum state with a temporal shape non-locally affected by the modulation. We found conditions for the shape of the heralded photon to reproduce the modulation function. The method can be implemented with various sources of time-energy entangled photons. In particular, using entangled photons from the parametric down-conversion the method enables generation of pure photons with tunable shape within unprecedentedly broad range of temporal durations -from tenths of femtoseconds to microseconds. Proposed shaping of single photons will push forward implementation of scalable multidimensional quantum information protocols, efficient photon-matter coupling and quantum control at the level of single quanta.Single photons are indispensable tool in quantum information, quantum communication and quantum metrology [1]. Depending on specific application, photons must be tuned in wavelength, bandwidth, polarization, and other degrees of freedom. For example, to transmit information over optical fibers one uses photons at telecom wavelengths, while photonatom coupling requires wavelength and bandwidth of photons matched to the corresponding atomic transition.It has been realized in the last decade that full control over the spatio-temporal shape of a single photon light [2, 3] is required in a number of applications. For example, photons, having identical Lorentzian spectral shapes, can exhibit opposite temporal shapes -exponential decaying or rising -depending on spectral distribution of the phase. As a result, photons with exponential decaying shape excite a two-level atom in free space only with 50% efficiency, while exponentially rising photons with 100% efficiency [4][5][6]. There are other situations where the temporal photon shape is important: symmetric shape is optimal for cavity QED quantum communication [7]; Gaussian shape is superior for experiments relying on single-photon interference [8]. Furthermore, development of sources of shaped photons will push forward photonic implementation of high-dimensional quantum information protocols, e.g. quantum key distribution [9][10][11][12][13][14].Present-day methods for producing temporally shaped photons can be divided in two groups: single photons are shaped either during the generation process or photon shaping is performed after the generation. Methods of the first group are typically based on control of quantum emitters (single atom [15,16], ion [17], atomic ensemble [18], quantum dot [19]). Development of these methods is promising for deterministic production of shaped photons, however the methods often require sophisticated and costly setup...