The calculation of 1D electromagnetic (EM) responses of dipole sources is considered as a fundamental computation kernel in several geophysical applications, ranging from EM sensitivity analysis to high-dimensional EM forward modeling and inversion. To solve the EM responses caused by electric and magnetic dipoles with different orientations, we have developed an open-source MATLAB code for a complete treatment, which allows for an arbitrary transmitter-receiver geometry in the multilayered earth. A complete derivation of the EM field expressions with simplified exponent terms for all traditional dipole sources is accomplished based on the vector potential differential equations. The quadrature-with-extrapolation algorithm is adapted for calculating the integration of Bessel functions to produce EM responses with a desired accuracy. The MATLAB digit functions are used to alleviate the instability problem caused by the exponent terms. The accuracy of our code is verified by comparing the results with the published data and self-checks on an infinite thin sheet. A layered model is designed to test the capability of our code for all traditional dipole sources by placing the receiver at different depths. In the end, we apply our code to marine and airborne controlled-source EM explorations. The results indicate that our code is accurate and can potentially be used to calculate 1D EM responses for general EM problems.