---
title: "Magento 2: How to Create a Password or an Encrypted Field in System Configuration"
url: "https://magecomp.com/blog/magento-2-create-a-password-or-an-encrypted-field-in-system-configuration/"
date: "2023-03-24T18:53:02+00:00"
modified: "2025-06-06T04:43:53+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 274
reading_time: "2 min read"
summary: "Hello Magento Friends,"
description: "Magento 2: Learn how to create a Password or Encrypted Field in System Configuration. Follow this guide to securely store sensitive data in your admin panel."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to add custom Button on Admin Sales Order View page in Magento 2?"
    url: "https://magecomp.com/blog/add-custom-button-admin-sales-order-view-page-magento-2/"
  - title: "How to Setup Multi Store in Magento 2 (Updated)"
    url: "https://magecomp.com/blog/setup-multi-store-in-magento-2/"
  - title: "Magento 2: How to Display Thumbnail Image on UI Component Grid"
    url: "https://magecomp.com/blog/magento-2-display-thumbnail-image-on-ui-component-grid/"
---

# Magento 2: How to Create a Password or an Encrypted Field in System Configuration

_Published: March 24, 2023_  
_Author: Dhiren Vasoya_  

![How to Create a Password or an Encrypted Field in System Configuration m2](https://magecomp.com/blog/wp-content/uploads/2023/03/How-to-Create-a-Password-or-an-Encrypted-Field-in-System-Configuration-m2-1024x512.webp)

**Hello Magento Friends,**

Today I am here with a new Magento 2 solution. Today it’s about How to Create a Password or an Encrypted Field in Magento 2 System Configuration.
[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-2.webp)](https://magecomp.com/services/magento-upgrade-services/)

You might need to add a password field in the system configuration where the input type is abstruse, meaning the data is not shown as text. To create a password type field in the system configuration, perform the below step.
## Steps to Create a Password or an Encrypted Field in Magento 2 System Configuration:
**Step 1:** First, create a **system.xml** file at the below path
**app\code\Vendor\Extension\etc\adminhtml**

We use the **“obscure”** field type and **Magento\Config\Model\Config\Backend\Encrypted** as the backend_model.
In the file **app/code/Vendor/Extension/etc/adminhtml/system.xml** add a new field as below:
```
<field id='encrypted_password' translate='label' type='obscure' sortOrder='3' showInDefault='1' showInWebsite='1' showInStore='1'>
	<label>Password</label>
	<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
```

Now, you can find that the password field is added to the admin system configuration with encrypted input. When you input any data, it will be shown as dots.
[![password field in system configuration](https://magecomp.com/blog/wp-content/uploads/2023/03/password-field-in-system-configuration.png)](https://magecomp.com/blog/wp-content/uploads/2023/03/password-field-in-system-configuration.png)

## [![Magento Malware Removal](https://magecomp.com/blog/wp-content/uploads/2023/04/Magento-Malware-Removal-CTA-1.webp)](https://magecomp.com/magento-malware-removal.html)

## Conclusion:
This way, you can add a password-like field or an encrypted field in Magento 2 system configuration.
Moreover, you can create the following fields in the Magento 2 system configuration:
- [**Image upload field**](https://magecomp.com/blog/magento-2-add-image-upload-field-in-system-configuration/)
- [**Dynamic generated field**](https://magecomp.com/blog/create-dynamic-generated-field-system-configuration-magento-2/)

Also, perform the following actions on Magento 2 system configuration field:
- [**Add Custom Validation**](https://magecomp.com/blog/magento-2-how-to-add-custom-validation-to-system-configuration-field/)
- [**Disable System Configuration Field Programmatically**](https://magecomp.com/blog/disable-system-configuration-field-programmatically-magento-2/)

Share this tutorial with your friends and stay updated for more!
[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-3.webp)](https://magecomp.com/magento-performance-optimization.html)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/magento-2-create-a-password-or-an-encrypted-field-in-system-configuration/](https://magecomp.com/blog/magento-2-create-a-password-or-an-encrypted-field-in-system-configuration/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-10-13 15:57:46 UTC_  
