Skip to content

Migrating from 3x ui

RomanovCaesar edited this page Oct 23, 2026 · 3 revisions

English | 简体中文

Migrating from 3x-ui

m-ui can import a 3x-ui panel, or any plain Xray configuration, in one step. Open the Dashboard, find the Manage card and click Import. The importer turns Xray inbounds, outbounds and routing rules into Mihomo listeners, proxies and rules and adds them to the panel. The importer is available since v0.3.0.

What to upload

File Where to get it What it keeps
x-ui.db (recommended) 3x-ui Overview → Backup → Back Up, or copy /etc/x-ui/x-ui.db from the server Inbounds, every client with its traffic quota, expiry date (including "N days after first use"), enabled state, comment and used traffic, subscription IDs, per-client traffic reset and auto-renewal (reset, resetDay, resetWeekday, resetMax), inbound quota/expiry/reset schedule and reset day, outbounds and routing rules from the Xray template
config.json 3x-ui Overview → Config → download, or copy /usr/local/x-ui/bin/config.json Inbounds with client credentials, outbounds and routing rules

You can also paste JSON into the dialog: a full Xray configuration, one inbound object, or a list of inbounds.

config.json is the configuration 3x-ui hands to Xray, so it only carries what Xray needs. Disabled and depleted clients are missing from it, and so are quotas, expiry dates and traffic. Use x-ui.db whenever you can.

Supported versions: 3x-ui v2.9.3 through v3.10.2, the latest release at the time of writing. Both database layouts are read: the 2.x layout, where clients live in the inbound's settings JSON, and the 3.1+ layout with separate clients and client_inbounds tables. 3x-ui 3.x installations that store data in PostgreSQL have no x-ui.db; import their config.json.

Import rules

The import only adds. Nothing already in the panel is changed or removed.

  • Port conflicts: when an imported inbound uses a port that an existing inbound (or the panel itself) already listens on, the existing inbound is kept and the imported one is skipped.
  • Name conflicts: an inbound or outbound whose name is taken gets a -xray suffix (-xray-2, and so on).
  • Routing rules: imported rules are inserted before the final MATCH rule. Rules identical to existing ones are skipped.
  • Subscriptions: a 3x-ui subscription ID becomes the client's m-ui username and subscription token, so existing subscription links keep their token. Only the panel address and subscription path need to point to m-ui.

After the import the dialog shows how many inbounds, clients, outbounds and rules were imported or skipped, and lists the first things to check. Click Download conversion log for the full report; the dialog and the log are written in the panel language. Imported settings take effect after Restart Mihomo.

How Xray maps to Mihomo

Xray / 3x-ui Mihomo in m-ui
VLESS, VMess, Trojan inbounds over TCP (raw), WebSocket, gRPC; XHTTP for VLESS; mKCP for VMess; TLS or Reality Listeners of the same type
Shadowsocks inbound with one user shadowsocks listener
SOCKS, HTTP, Mixed inbounds Listeners with the same accounts
Hysteria (v2) inbound, including Salamander obfuscation hysteria2 listener
TUIC inbound (3x-ui 3.8+) tuic listener
freedom / blackhole outbounds DIRECT / REJECT
VLESS, VMess, Trojan, Shadowsocks, SOCKS, HTTP, Hysteria2, WireGuard outbounds Proxies; proxySettings / dialerProxy becomes dialer-proxy
Balancers url-test (leastPing, leastLoad) or load-balance groups
domain, ip, port, sourcePort, localPort, network, source, inboundTag, user rule conditions DOMAIN*, GEOSITE, IP-CIDR, GEOIP, DST-PORT, SRC-PORT, IN-PORT, NETWORK, SRC-IP-CIDR, IN-NAME, IN-USER
A rule with several conditions One AND rule

What cannot be imported

These items are skipped or dropped, and each one is listed in the conversion log with the reason:

  • Shadowsocks inbounds with several users, including Shadowsocks 2022 with per-user keys. Mihomo listeners accept one Shadowsocks user per port.
  • TCP inbounds with HTTP header obfuscation, HTTPUpgrade inbounds, WireGuard inbounds, tunnel (dokodemo-door) and TUN inbounds.
  • 3x-ui add-ons that run outside Xray, such as MTProto, AmneziaWG and MASQUE, and inbounds that run on a remote 3x-ui node.
  • Fallbacks. A fallback target is imported as a separate listener on its own port.
  • Per-client IP limits (limitIp).
  • Routing conditions Mihomo cannot match, such as protocol (BitTorrent sniffing) and attrs. When only part of a rule can be expressed, the rest is noted in the log.
  • DNS and loopback outbounds.

TLS certificates given as file paths are imported as paths. If the log says a certificate file does not exist, copy it to the same path on the m-ui server, or edit the inbound, before restarting Mihomo.

Tips

  • Install m-ui on a new server, or on the same server after stopping 3x-ui, so the ports are free.
  • Run the import once. A second import of the same file skips every inbound because the ports are taken, and adds renamed copies of the outbounds.
  • Look at Mihomo Settings → Routing Rules afterwards. Xray sends unmatched traffic to its first outbound, while m-ui keeps its own final MATCH rule.

Clone this wiki locally