Understanding patient preference regarding taking tablet or capsule formulations plays a pivotal role in treatment efficacy and adherence. Therefore, these preferences should be taken into account when designing formulations and prescriptions. This study investigates the factors affecting patient preference in patients who have difficulties swallowing large tablets or capsules and aims to identify appropriate sizes for tablets and capsules. A robust data set was developed based on a questionnaire survey conducted from December 1, 2022, to December 7, 2022, using the harmo smartphone app operated by harmo Co, Ltd. The data set included patient input regarding their tablet and capsule preferences, personal health records (including dispensing history), and drug formulation information (available from package inserts). Based on the medication formulation information, 6 indices were set for each of the tablets or capsules that were considered difficult to swallow owing to their large size and concomitant tablets or capsules (used as controls). Receiver operating characteristic (ROC) analysis was used to evaluate the performance of each index. The index demonstrating the highest area under the curve of the ROC was selected as the best index to determine the tablet or capsule size that leads to swallowing difficulties. From the generated ROCs, the point with the highest discriminative performance that maximized the Youden index was identified, and the optimal threshold for each index was calculated. Multivariate logistic regression analysis was performed to identify the risk factors contributing to difficulty in swallowing oversized tablets or capsules. Additionally, decision tree analysis was performed to estimate the combined risk from several factors, using risk factors that were significant in the multivariate logistic regression analysis. This study analyzed 147 large tablets or capsules and 624 control tablets or capsules. The "long diameter + short diameter + thickness" index (with a 21.5 mm threshold) was identified as the best indicator for causing swallowing difficulties in patients. The multivariate logistic regression analysis (including 132 patients with swallowing difficulties and 1283 patients without) results identified the following contributory risk factors: aged <50 years (odds ratio [OR] 1.59, 95% CI 1.03-2.44), female (OR 2.54, 95% CI 1.70-3.78), dysphagia (OR 3.54, 95% CI 2.22-5.65), and taking large tablets or capsules (OR 9.74, 95% CI 5.19-18.29). The decision tree analysis results suggested an elevated risk of swallowing difficulties for patients with taking large tablets or capsules. This study identified the most appropriate index and threshold for indicating that a given tablet or capsule size will cause swallowing difficulties, as well as the contributory risk factors. Although some sampling biases (eg, only including smartphone users) may exist, our results can guide the design of patient-friendly formulations and prescriptions, promoting better medication adherence.