A Bayes factor is proposed for testing whether the effect of a key predictor variable on a dependent variable is linear or nonlinear, possibly while controlling for certain covariates. The test can be used (i) in substantive research for assessing the nature of the relationship between certain variables based on scientific expectations, and (ii) for statistical model building to infer whether a (transformed) variable should be added as a linear or nonlinear predictor in a regression model. Under the nonlinear model, a Gaussian process prior is employed using a parameterization similar to Zellner’s <i>g</i> prior resulting in a scale-invariant test. Unlike existing <i>p</i>-values, the proposed Bayes factor can be used for quantifying the relative evidence in the data in favor of linearity. Furthermore the Bayes factor does not overestimate the evidence against the linear null model resulting in more parsimonious models. An extension is proposed for Bayesian one-sided testing of whether a nonlinear effect is consistently positive, consistently negative, or neither. Applications are provided from various fields including social network research and education.