We present a flexible algorithm for modelling of 3D direct current (DC) resistivity and time-domain induced polarization (IP) data. A structured model mesh allows easy implantation of constrains, whereas the finite-element forward algorithm is based on unstructured tetrahedral meshes and therefore handles both topography, arbitrary shaped boundaries and local refinement. This, together with modelling of the secondary potential field for singularity removal around the sources, ensures high accuracy. Electrodes may be placed on the boundaries or arbitrarily in the subsurface thus allowing both surface and cross-borehole applications. The forward response is computed in frequency-domain and then transformed to time-domain using the Hankel Transform, taking into account the current waveform and system filters for a quantitative IP modelling of either full-decay IP responses or integral chargeability allowing the IP phenomenon to be parameterised using any IP parameterization. An accuracy test of the forward response shows the advantages of the singularity removal (computing primary and secondary potential fields separately) as it decreases the relative deviation to the analytic solution significantly compared to computing the total field.