Cardiovascular disease (CVD) or heart disease is one of the main reasons for early death, even at young age and that too often sudden. If it is detected more accurately, much before it seriously affects the individual, life can be saved through proper medication and changes in lifestyles. In this work different machine learning classifiers and a deep learning algorithm multi-layer perceptron (MLP) were applied on two different datasets, Framingham heart study dataset and UCI heart disease dataset for prediction of heart disease. These algorithms were optimized using hyperparameter tuning and compared for their performance measures and prediction accuracies. For different features, feature importance scores were calculated using machine learning algorithms. The features were ranked according to their scores. Out of various classification algorithms, random forest algorithm has shown the best results with prediction accuracy of 97.13% for Framingham dataset. MLP has shown good performance for both the datasets.