diff --git a/webform_features.install b/webform_features.install
index 65ad7a6..0023cc9 100644
--- a/webform_features.install
+++ b/webform_features.install
@@ -11,14 +11,14 @@
 function webform_features_schema_alter(&$schema) {
   $schema['webform']['fields']['machine_name'] = array(
     'type' => 'varchar',
-    'length' => 32,
+    'length' => WEBFORM_FEATURES_MACHINE_NAME_MAXLENGTH,
     'not null' => TRUE,
     'default' => '',
     'description' => 'The machine name of the webform. Used during exports & for template suggestions.',
   );
   $schema['webform_component']['fields']['machine_name'] = array(
     'type' => 'varchar',
-    'length' => 128,
+    'length' => (2 * WEBFORM_FEATURES_MACHINE_NAME_MAXLENGTH) + 2,
     'not null' => TRUE,
     'default' => '',
     'description' => "The machine name of the webform's component. Used during exports.",
@@ -43,6 +43,7 @@ function webform_features_install() {
   }
 
   // Populate existing webforms' machine names
+  $maxlength = WEBFORM_FEATURES_MACHINE_NAME_MAXLENGTH;
   $query = db_select('node', 'n')
     ->fields('n', array('nid', 'title', 'type'))
     ->condition('type', webform_variable_get('webform_node_types'), 'IN')
@@ -71,7 +72,8 @@ function webform_features_install() {
     $i = 1;
     $exists = webform_features_machine_name_load($name);
     while (!empty($exists) && $exists->nid != $node->nid) {
-      $name = $machine_name . '_' . ++$i;
+      $suffix = '_' . ++$i;
+      $name = substr($machine_name, 0, $maxlength - strlen($suffix)) . $suffix;
       $exists = webform_features_machine_name_load($name);
     }
 
@@ -81,6 +83,7 @@ function webform_features_install() {
   }
 
   // Populate existing webform_components' machine names
+  $maxlength = (2 * WEBFORM_FEATURES_MACHINE_NAME_MAXLENGTH) + 2;
   $query = db_select('webform_component', 'wc')
     ->fields('wc', array('nid', 'cid', 'form_key', 'machine_name'))
     ->orderBy('nid', 'ASC');
@@ -108,7 +111,8 @@ function webform_features_install() {
     $i = 1;
     $exists = !empty($existing[$name]);
     while (!empty($exists) && $exists->nid != $node->nid) {
-      $name = $machine_name . '_' . ++$i;
+      $suffix = '_' . ++$i;
+      $name = substr($machine_name, 0, $maxlength - strlen($suffix)) . $suffix;
       $exists = !empty($existing[$name]);
     }
 
diff --git a/webform_features.module b/webform_features.module
index 1b90a38..058bd39 100644
--- a/webform_features.module
+++ b/webform_features.module
@@ -6,6 +6,17 @@
  */
 
 /**
+ * Webform machine names are limited to this length.
+ *
+ * Component machine names also use this limit in the UI, but may be up to
+ * ((2 * this length) + 2) chars internally, as they contain their webform's
+ * machine name as a prefix, with a 2 character '__' separator in between.
+ *
+ * These are stored as varchar(255), and so this value is limited to 126.
+ */
+define('WEBFORM_FEATURES_MACHINE_NAME_MAXLENGTH', 126);
+
+/**
  * Implements hook_form_alter().
  */
 function webform_features_form_alter(&$form, &$form_state, $form_id) {
@@ -15,7 +26,7 @@ function webform_features_form_alter(&$form, &$form_state, $form_id) {
     $form['machine_name'] = array(
       '#type' => 'machine_name',
       '#default_value' => !empty($node->webform['machine_name']) ? $node->webform['machine_name'] : '',
-      '#maxlength' => 32,
+      '#maxlength' => WEBFORM_FEATURES_MACHINE_NAME_MAXLENGTH,
       '#required' => TRUE,
       '#disabled' => empty($node->is_new) && !empty($node->nid),
       '#machine_name' => array(
@@ -35,7 +46,7 @@ function webform_features_form_alter(&$form, &$form_state, $form_id) {
     $form['machine_name'] = array(
       '#type' => 'machine_name',
       '#default_value' => !empty($component) ? substr($component['machine_name'], strrpos($component['machine_name'], '__') + 2) : $form['form_key']['#default_value'],
-      '#maxlength' => 32,
+      '#maxlength' => WEBFORM_FEATURES_MACHINE_NAME_MAXLENGTH,
       '#required' => TRUE,
       '#disabled' => !empty($form['cid']['#value']),
       '#element_validate' => array('webform_features_component_machine_name_validate'),
